summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog399
-rw-r--r--debian/compat1
-rw-r--r--debian/control28
-rw-r--r--debian/copyright29
-rw-r--r--debian/hurd-dev.install3
-rw-r--r--debian/hurd.dirs2
-rw-r--r--debian/hurd.install65
-rw-r--r--debian/hurd.postinst22
-rw-r--r--debian/local/rc137
-rwxr-xr-xdebian/make-new-orig.sh13
-rwxr-xr-xdebian/make-new-tarball.sh14
-rw-r--r--debian/patches-contrib/kbd.patch815
-rw-r--r--debian/patches/console_switch3.patch839
-rw-r--r--debian/patches/exec.patch14
-rw-r--r--debian/patches/mouse.patch485
-rw-r--r--debian/patches/no-debian-dir.patch11
-rw-r--r--debian/patches/ttys.patch13
-rwxr-xr-xdebian/rules34
18 files changed, 2924 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 00000000..6062450f
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,399 @@
+hurd (20040508-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Switch packaging to cdbs
+ * Do not provide /boot/serverboot or /boot/servers.boot
+ * Update policy to 3.6.1.0
+ * Do not provide update-rc.d, use the one from sysvinit instead
+ (Closes: #246813) - Thanks to Robert Millan
+ * Do not provide /sbin/fsck, use the one from e2fsprogs instead
+ Thanks to Robert Millan
+
+ -- Jeff Bailey <jbailey@raspberryginger.com> Sat, 8 May 2004 16:55:18 -0400
+
+hurd (20021118-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ kbd, mouse as usual, with bug fixes from David Walter.
+ Change terminal type to mach-color.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Tue, 18 Nov 2002 21:32:22 +0200
+
+hurd (20021011-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ kbd, mouse as usual.
+ Build libpthread.
+ debian/control: Add libncursesw5-dev as build-dependency.
+ debian/shlibs: Add libpthread
+ debian/control: Add myself as an uploader.
+
+ -- Neal H. Walfield <neal@desdemona> Fri, 11 Oct 2002 21:42:21 -0400
+
+hurd (20020918-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Tue, 18 Sep 2002 23:13:06 +0200
+
+hurd (20020804-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 4 Aug 2002 20:46:28 +0200
+
+hurd (20020523-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 23 May 2002 15:29:40 +0200
+
+hurd (20020418-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 18 Apr 2002 15:22:39 +0200
+
+hurd (20011105-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual (well, the intention was there :).
+ Change terminal type to mach-color.
+ Compiled with -O2 rather than -O3.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Mon, 5 Nov 2001 00:00:26 +0100
+
+hurd (20011016-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+ Compiled with -O2 rather than -O3.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Tue, 16 Oct 2001 19:43:21 +0200
+
+hurd (20011013-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+ Compiled with -O2 rather than -O3.
+ * debian/rules: Change way how to find executables by Kevin Kreamer.
+ * debian/control: Add `file' to build dependencies by Kevin Kreamer.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sat, 13 Oct 2001 01:05:30 +0200
+
+hurd (20010817-2) unstable; urgency=low
+
+ * Include a copy of update-rc.d, moved from dpkg to init providing
+ package.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 2 Sep 2001 19:40:00 +0200
+
+hurd (20010817-1) unstable; urgency=low
+
+ * New snapshot from CVS, closes: #105476, #39894.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+ Compiled with -O2 rather than -O3.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Fri, 17 Aug 2001 22:16:01 +0200
+
+hurd (20010718-1) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+ Compiled with -O2 rather than -O3.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 18 Jul 2001 21:43:52 +0200
+
+hurd (20010608) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+ Compiled with -O2 rather than -O3.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Fri, 8 Jun 2001 23:02:47 +0200
+
+hurd (20010527) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sat, 27 May 2001 01:34:21 +0200
+
+hurd (20010426) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+ storeio hack to prevent double activation.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Fri, 27 Apr 2001 00:09:56 +0200
+
+hurd (20010311) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Additional patches:
+ kbd, mouse as usual.
+ Change terminal type to mach-color.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 11 Mar 2001 22:45:21 +0100
+
+hurd (20010111) unstable; urgency=low
+
+ * New snapshot from CVS, containing lots of small bug fixes, and:
+ + Together with gnumach 1.2-9, you can access large stores with
+ storeinfo, storeread (because libstore uses the new interface in
+ gnumach, and off64_t internally).
+ + pfinet contains support for network ioctls. The corresponding
+ changes in the glibc library are not available in Debian yet, though.
+ * streamdev is renamed to streamio.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Fri, 12 Jan 2001 00:06:41 +0100
+
+hurd (20001204) unstable; urgency=low
+
+ * New snapshot from CVS, with a couple of bug fixes:
+ pfinet: Don't leak references.
+ ext2fs, ufs: Avoid a dn_set_?time vs sync thread race.
+ Corretly deny too long filenames.
+ nfsd: Fix a couple of memory leaks.
+
+ * Additional patchs:
+ libdiskfs: Don't crash when symlink target is the empty string.
+ streamdev, kbd, mouse: New translators for X and klog device.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Mon, 4 Dec 2000 15:18:39 +0100
+
+hurd (20001127) unstable; urgency=low
+
+ * New snapshot from CVS, really fixes isofs now.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Mon, 27 Nov 2000 21:07:03 +0100
+
+hurd (20001126) unstable; urgency=low
+
+ * New snapshot from CVS, closes: #68417, #69281, #68626
+ * Fix in 20001030 closes: #72319
+ * debian/control: Add build dependencies, closes: #75734
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 26 Nov 2000 05:53:19 +0100
+
+hurd (20001030) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Still contains all the goodies, streadev, kbd, mouse. Now opening
+ kbd, mouse more than once doesn't crash them (thanks Erik Verbruggen
+ <ejv@cs.kun.nl>)
+ * sutils/MAKEDEV.sh: kmsg is really klog.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Tue, 30 Oct 2000 18:02:29 +0200
+
+hurd (20000921) unstable; urgency=low
+
+ * New snapshot from CVS
+ * Add streamdev by OKUJI Yoshinori
+ (source: ftp://alpha.gnu.org/contrib/okuji/hurd/streamdev-19990920.tar.gz)
+ * Add kbd and mouse by UCHIYAMA Yasushi <uch@nop.or.jp>.
+ * sutils/MAKEDEV.sh: Add kbd and kmsg. No sense to add mouse, as you need
+ to configure it (see /hurd/mouse --help).
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sat, 23 Sep 2000 04:27:58 +0200
+
+hurd (20000803) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * isofs: Patch to fix symlink handling.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 3 Aug 2000 21:09:44 +0200
+
+hurd (20000726) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Fixes the infamous zero hole bug (actually both of them).
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Wed, 26 Jul 2000 02:24:06 +0200
+
+hurd (20000703) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * exec/hashexec.c (check_hashbang: Fix off by one error in line 178.
+ Patch by Kalle Olavi Niemital.
+
+ -- Marcus Brinkmann <bug-hurd@gnu.org> Mon, 3 Jul 2000 00:44:47 +0200
+
+hurd (20000130) unstable; urgency=low
+
+ * New snapshot from CVS. Closes: Bug#54282, Bug#40302, Bug#56076.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 30 Jan 2000 14:55:39 +0100
+
+hurd (19991209) unstable; urgency=low
+
+ * New snapshot from CVS.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 9 Dec 1999 23:43:23 +0100
+
+hurd (19991022) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * libdiskfs/init-startup.c: Disable periodic syncing before shutting down.
+ This fixes the fs-unclean-on-reboot bug!
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Fri, 22 Oct 1999 21:32:02 +0200
+
+hurd (19991004) unstable; urgency=high
+
+ * New snapshot from CVS.
+ term: Realize bogus devices.
+ ext2fs: Important bug fixes!
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 3 Oct 1999 18:01:17 +0200
+
+hurd (19990923) unstable; urgency=low
+
+ * New snapshot from CVS.
+ MAKEDEV: pty created with mode 0666.
+ Implements pathconf for libdiskfs and libnetfs.
+ Various bug fixes.
+ * Development package now includes pic libraries.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 19 Sep 1999 19:29:00 +0200
+
+hurd (19990907) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * gzip /boot/serverboot to /boot/serverboot.gz
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Mon, 23 Aug 1999 15:12:10 +0200
+
+hurd (19990725) unstable; urgency=low
+
+ * New snapshot from CVS.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 25 Jul 1999 16:16:03 +0200
+
+hurd (19990714) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * debian/rules: etc/motd is in base-files, do not include it.
+ * Activate split-init.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Wed, 14 Jul 1999 16:38:00 +0200
+
+hurd (19990616) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Now contains info and ps documentation.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 17 Jun 1999 17:35:54 +0200
+
+hurd (19990524) unstable; urgency=low
+
+ * New snapshot from CVS.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Mon, 24 May 1999 15:09:45 +0200
+
+hurd (19990523) unstable; urgency=low
+
+ * New snapshot from CVS, fixes: #38062, #37670, #37878, #37944.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Mon, 24 May 1999 01:08:26 +0200
+
+hurd (19990517fixed) unstable; urgency=low
+
+ * debian/shlibs: corrected.
+ * exec/hashexec.c: Applied patch by Roland to make it work.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 17 May 1999 00:25:11 +0200
+
+hurd (19990517) unstable; urgency=low
+
+ * New snapshot from CVS.
+ * Add shlibs file.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 16 May 1999 15:28:09 +0200
+
+hurd (19990425-1) unstable; urgency=low
+
+ * Put shared library symlinks into the hurd-dev package.
+ * Clarify instructions in provided servers.boot.
+ * libfshelp/fetch-root.c: De-patched a change by tb which produced
+ strange errors.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 29 Apr 1999 22:47:51 +0200
+
+hurd (19990212-2) unstable; urgency=low
+
+ * debian/control: Added Depends line for Hurd.
+ * Update docs to reflect new group maintainership.
+ * debian/copyright: Hurd libraries are *not* under the LGPL, so add a
+ clarifying note.
+ * Put static libraries and header files into /usr/lib and /usr/include
+ for people without the /usr symlink.
+
+ -- Gordon Matzigkeit <bug-hurd@gnu.org> Wed, 17 Feb 1999 15:40:44 -0600
+
+hurd (19990212-1) unstable; urgency=low
+
+ * New upstream version from CVS.
+ * Deleted old libthreads... there's no going back now.
+
+ -- Gordon Matzigkeit <gord@debian.org> Fri, 12 Feb 1999 03:25:55 -0600
+
+hurd (19981204-1) unstable; urgency=low
+
+ * New upstream release, supposed to work with glibc 2.0.106.
+ * Commented out use of old libthreads.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Sun, 20 Dec 1998 04:24:40 +0100
+
+hurd (19980915-2) unstable; urgency=low
+
+ * exec/hashexec.c: Applied patch by Thomas Bushnell to fix make.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Fri, 6 Nov 1998 23:10:11 +0100
+
+hurd (19980915-1) unstable; urgency=low
+
+ * New upstream release.
+ * debian/rules: Strip all binaries.
+ * debian/TODO: New file.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Thu, 8 Oct 1998 03:34:40 +0200
+
+hurd (19980716-2) unstable; urgency=low
+
+ * Reverted libthreads to provide threadsafe malloc, as we use older
+ version of glibc2 for now.
+ * Do not remove size 0 files in 'rules clean', because hurd depends on
+ them.
+ * Do not build profiling libraries.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Tue, 4 Aug 1998 21:58:55 +0200
+
+hurd (19980716-1) unstable; urgency=low
+
+ * Initial Version.
+
+ -- Marcus Brinkmann <brinkmd@debian.org> Tue, 4 Aug 1998 21:58:55 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 00000000..b8626c4c
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
new file mode 100644
index 00000000..98460285
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,28 @@
+Source: hurd
+Section: base
+Priority: required
+Maintainer: GNU Hurd Maintainers <bug-hurd@gnu.org>
+Standards-Version: 3.6.1.0
+Build-Depends: mig (>= 1.3-2), texinfo, libncursesw5-dev, cdbs, debhelper
+Uploaders: Jeff Bailey <jbailey@raspberryginger.com>, Marcus Brinkmann <brinkmd@debian.org>, Neal H. Walfield <neal@debian.org>
+
+Package: hurd
+Priority: required
+Section: base
+Essential: yes
+Depends: sysv-rc, ${shlibs:Depends}
+Provides: makedev, login, fakeroot
+Replaces: makedev, login, fakeroot
+Conflicts: makedev, login, fakeroot
+Architecture: hurd-i386
+Description: The GNU Hurd
+ This is the GNU Hurd package. It contains essential system software and
+ libraries.
+
+Package: hurd-dev
+Priority: standard
+Section: libdevel
+Architecture: hurd-i386
+Depends: hurd
+Description: The GNU Hurd (development files)
+ This package includes the header files and the static libraries.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 00000000..51ed720a
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,29 @@
+This package was debianized by Marcus Brinkmann <brinkmd@debian.org>
+on Tue, 4 Aug 1998 21:52:45 +0200
+
+It is currently maintained by its upstream authors, who can be reached
+via <bug-hurd@gnu.org>.
+
+Sources are available from ftp://alpha.gnu.org/pub/hurd/src/
+
+Copyright statement:
+
+Note that the libraries distributed with the GNU Hurd are placed under
+the standard GNU General Public License (*not* the Library 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; version 2 dated June, 1991.
+
+ 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
+
+On Debian systems, the complete text of the GNU General Public License
+can be found in `/usr/share/common-licenses/GPL'.
diff --git a/debian/hurd-dev.install b/debian/hurd-dev.install
new file mode 100644
index 00000000..68e9982f
--- /dev/null
+++ b/debian/hurd-dev.install
@@ -0,0 +1,3 @@
+debian/tmp/lib/*.a usr/lib
+debian/tmp/include/* usr/include
+debian/tmp/lib/*.so usr/lib
diff --git a/debian/hurd.dirs b/debian/hurd.dirs
new file mode 100644
index 00000000..80440e37
--- /dev/null
+++ b/debian/hurd.dirs
@@ -0,0 +1,2 @@
+servers
+
diff --git a/debian/hurd.install b/debian/hurd.install
new file mode 100644
index 00000000..a087fc81
--- /dev/null
+++ b/debian/hurd.install
@@ -0,0 +1,65 @@
+debian/tmp/lib/*.so.*
+debian/tmp/lib/hurd/console/*.so.*
+debian/tmp/hurd/*
+debian/local/rc libexec
+debian/tmp/libexec/getty
+debian/tmp/libexec/console-run
+debian/tmp/libexec/runttys
+debian/tmp/libexec/runsystem.gnu
+debian/tmp/sbin/nfsd
+debian/tmp/sbin/e2os
+debian/tmp/sbin/MAKEDEV
+debian/tmp/sbin/losetup
+debian/tmp/sbin/reboot
+debian/tmp/sbin/halt
+debian/tmp/sbin/fsck
+debian/tmp/sbin/swapon
+debian/tmp/sbin/swapoff
+debian/tmp/sbin/fsck.ufs
+debian/tmp/sbin/mkfs.ufs
+debian/tmp/sbin/clri.ufs
+debian/tmp/sbin/stati.ufs
+debian/tmp/bin/boot
+debian/tmp/bin/console
+debian/tmp/bin/shd
+debian/tmp/bin/ps
+debian/tmp/bin/settrans
+debian/tmp/bin/showtrans
+debian/tmp/bin/syncfs
+debian/tmp/bin/fsysopts
+debian/tmp/bin/storeinfo
+debian/tmp/bin/login
+debian/tmp/bin/w
+debian/tmp/bin/uptime
+debian/tmp/bin/ids
+debian/tmp/bin/loginpr
+debian/tmp/bin/sush
+debian/tmp/bin/vmstat
+debian/tmp/bin/portinfo
+debian/tmp/bin/devprobe
+debian/tmp/bin/vminfo
+debian/tmp/bin/addauth
+debian/tmp/bin/rmauth
+debian/tmp/bin/unsu
+debian/tmp/bin/setauth
+debian/tmp/bin/ftpcp
+debian/tmp/bin/ftpdir
+debian/tmp/bin/storecat
+debian/tmp/bin/storeread
+debian/tmp/bin/msgport
+debian/tmp/bin/rpctrace
+debian/tmp/bin/mount
+debian/tmp/bin/gcore
+debian/tmp/bin/fakeauth
+debian/tmp/bin/fakeroot
+debian/tmp/bin/forks
+debian/tmp/bin/timertest
+debian/tmp/bin/fstests
+debian/tmp/etc/login
+debian/tmp/etc/login/.bash_login
+debian/tmp/etc/login/.bashrc
+debian/tmp/etc/login/.hushlogin
+debian/tmp/etc/login/.profile
+debian/tmp/etc/login/README
+debian/tmp/etc/ttys
+debian/tmp/dev/MAKEDEV
diff --git a/debian/hurd.postinst b/debian/hurd.postinst
new file mode 100644
index 00000000..f066a6ef
--- /dev/null
+++ b/debian/hurd.postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+update-alternatives --quiet \
+ --install /libexec/runsystem runsystem /libexec/runsystem.gnu 20
+
+if ! grep --quiet '^login:' /etc/passwd; then
+ adduser --quiet --system --home /etc/login --gecos "Not logged in" --not-create-home login
+ chsh -s /bin/bash login
+fi
+
+#DEBHELPER#
+
+(cd /dev && /sbin/MAKEDEV vcs) || true
+(cd /dev && /sbin/MAKEDEV tty1) || true
+(cd /dev && /sbin/MAKEDEV tty2) || true
+(cd /dev && /sbin/MAKEDEV tty3) || true
+(cd /dev && /sbin/MAKEDEV tty4) || true
+(cd /dev && /sbin/MAKEDEV tty5) || true
+(cd /dev && /sbin/MAKEDEV tty6) || true
+
diff --git a/debian/local/rc b/debian/local/rc
new file mode 100644
index 00000000..d56a5f3f
--- /dev/null
+++ b/debian/local/rc
@@ -0,0 +1,137 @@
+#!/bin/bash
+PATH=/bin:/sbin
+
+# Start the default pager. It will bail if there is already one running.
+/hurd/mach-defpager
+
+# Set up swap space. This will complain if no default pager is functioning.
+swapon -a
+
+# Check filesystems.
+if [ -r /fastboot ]
+then
+ # ... or don't.
+ rm -f /fastboot
+ echo Fast boot ... skipping disk checks
+elif [ $1x = autobootx ]
+then
+ echo Automatic boot in progress...
+ date
+
+ /sbin/fsck --preen --writable
+
+ case $? in
+ # Successful completion
+ 0)
+ ;;
+ # Filesystem modified (but ok now)
+ 1 | 2)
+ ;;
+ # Fsck couldn't fix it.
+ 4 | 8)
+ echo "Automatic boot failed... help!"
+ exit 1
+ ;;
+ # Signal that really interrupted something
+ 20 | 130 | 131)
+ echo "Boot interrupted"
+ exit 1
+ ;;
+ # Special `let fsck finish' interruption (SIGQUIT)
+ 12)
+ echo "Boot interrupted (filesystem checks complete)"
+ exit 1
+ ;;
+ # Oh dear.
+ *)
+ echo "Unknown error during fsck (exit status $?)"
+ exit 1
+ ;;
+ esac
+fi
+
+echo -n cleaning up left over files...
+rm -f /etc/nologin
+rm -f /var/lock/LCK.*
+if test -d /tmp; then
+
+ # Forcibly remove all translators in the directory.
+ # It is then safe to attempt to remove files and descend directories.
+ # All parameters must begin with "./".
+ function remove_translators() {
+ local f
+ for f; do
+ settrans -pagfS "$f"
+ if [ -L "$f" ] || [ ! -d "$f" ]; then
+ rm "$f"
+ else
+ remove_translators "$f"/* "$f"/.[!.] "$f"/.??*
+ rmdir "$f"
+ fi
+ done
+ }
+
+ (cd /tmp
+ shopt -s nullglob
+ for f in * .[!.] .??*; do
+ case "$f" in
+ 'lost+found'|'quotas') ;;
+ *) remove_translators "./$f"
+ esac
+ done)
+
+ unset -f remove_translators # because it relies on nullglob
+
+fi
+
+if test -d /var/run; then
+ (cd /var/run && {
+ find . ! -type d ! -name utmp ! -name innd.pid \
+ -exec rm -f -- {} \;
+ cp /dev/null utmp
+ if grep -q ^utmp: /etc/group
+ then
+ chmod 664 utmp
+ chgrp utmp utmp
+ fi; })
+fi
+
+echo done
+
+# This file must exist for e2fsck to work. XXX
+touch /var/run/mtab
+
+#echo -n restoring pty permissions...
+#chmod 666 /dev/tty[pqrs]*
+#echo done
+
+#echo -n updating /etc/motd...
+#echo GNU\'s Not Unix Version `uname --release` > /tmp/newmotd
+#egrep -v 'GNU|Version' /etc/motd >> /tmp/newmotd
+#mv /tmp/newmotd /etc/motd
+#echo done
+
+chmod 664 /etc/motd
+
+(
+ trap ":" INT QUIT TSTP
+
+ if [ -d /etc/rc.boot ]
+ then
+ for i in /etc/rc.boot/S*
+ do
+ [ ! -f $i ] && continue
+ $i start
+ done
+ fi
+ if [ -d /etc/rc2.d ]
+ then
+ for i in /etc/rc2.d/S*
+ do
+ [ ! -f $i ] && continue
+ $i start
+ done
+ fi
+)
+
+date
diff --git a/debian/make-new-orig.sh b/debian/make-new-orig.sh
new file mode 100755
index 00000000..8f427623
--- /dev/null
+++ b/debian/make-new-orig.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+if [ -z $1 ]; then
+ echo "Please provide the directory to tar up as an argument"
+ exit 1
+fi
+
+TARBALL=$(echo $1 | tr - _).orig.tar.gz
+
+tar -czvf $TARBALL --exclude=debian $1
+
diff --git a/debian/make-new-tarball.sh b/debian/make-new-tarball.sh
new file mode 100755
index 00000000..f5c8028d
--- /dev/null
+++ b/debian/make-new-tarball.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+if [ -z $1 ]; then
+ echo "Please provide the directory to tar up as an argument"
+ exit 1
+fi
+
+BASENAME=$(basename $1)
+DIRNAME=$(dirname $1)
+
+tar -czvf hurd.tgz --exclude=CVS --exclude=.cvsignore --exclude=debian -C $DIRNAME $BASENAME
+
diff --git a/debian/patches-contrib/kbd.patch b/debian/patches-contrib/kbd.patch
new file mode 100644
index 00000000..f32d9a4d
--- /dev/null
+++ b/debian/patches-contrib/kbd.patch
@@ -0,0 +1,815 @@
+--- hurd-20040301.orig/hurd/subsystems
++++ hurd-20040301/hurd/subsystems
+@@ -37,6 +37,7 @@
+ pfinet 37000 Internet configuration calls
+ password 38000 Password checker
+ <ioctl space> 100000- First subsystem of ioctl class 'f' (lowest class)
++kdioctl 120000 Ioctl class 'k' (kd)
+ tioctl 156000 Ioctl class 't' (terminals)
+ tioctl 156200 (continued)
+ <ioctl space> 164200 Last subsystem of ioctl class 'v' (highest class)
+--- hurd-20040301.orig/hurd/kdioctl.defs
++++ hurd-20040301/hurd/kdioctl.defs
+@@ -0,0 +1,39 @@
++/* Definitions for kd ioctls
++ Copyright (C) 1991, 1993, 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
++
++This file is part of the GNU Hurd.
++
++The GNU Hurd is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to
++the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
++
++#include <hurd/hurd_types.defs>
++
++/* Ioctl class `k'; the subsystem is derived from calculations in
++ <ioctls.h>. */
++subsystem kdioctl 120000;
++
++import <hurd/ioctl_types.h>;
++
++skip; /* 0 unused */
++
++/* 1 KDSKBDMODE */
++routine kdioctl_kdskbdmode (
++ port: io_t;
++ in mode: int);
++/* 2 KDGKBDMODE */
++routine kdioctl_kdgkbdmode (
++ port: io_t;
++ out mode: int);
++
++/* 3 - 256 unused */
+--- hurd-20040301.orig/sutils/MAKEDEV.sh
++++ hurd-20040301/sutils/MAKEDEV.sh
+@@ -86,7 +86,7 @@
+ ;;
+
+ std)
+- mkdev console tty null zero full fd time mem klog shm
++ mkdev console tty null zero full fd time mem klog shm kbd
+ ;;
+ console|com[0-9])
+ st $I root 600 /hurd/term ${DEVDIR}/$I device $I;;
+@@ -115,6 +115,9 @@
+ st $I root 660 /hurd/storeio --no-cache mem ;;
+ klog)
+ st $I root 660 /hurd/streamio kmsg;;
++ kbd)
++ st $I root 666 /hurd/kbd;;
++
+ # ptys
+ [pt]ty[pqrstuvwxyzPQRS]?)
+ # Make one pty, both the master and slave halves.
+--- hurd-20040301.orig/trans/kd.h
++++ hurd-20040301/trans/kd.h
+@@ -0,0 +1,72 @@
++
++/*
++ * Format definitions for 'ioctl' commands in device definitions.
++ *
++ * From BSD4.4.
++ */
++/*
++ * 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.
++ */
++#define MACH_IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
++#define MACH_IOC_VOID 0x20000000 /* no parameters */
++#define MACH_IOC_OUT 0x40000000 /* copy out parameters */
++#define MACH_IOC_IN 0x80000000U /* copy in parameters */
++#define MACH_IOC_INOUT (MACH_IOC_IN|MACH_IOC_OUT)
++
++#define _MACH_IOC(inout,group,num,len) \
++ (inout | ((len & MACH_IOCPARM_MASK) << 16) | ((group) << 8) | (num))
++#define _MACH_IO(g,n) _MACH_IOC(MACH_IOC_VOID, (g), (n), 0)
++#define _MACH_IOR(g,n,t) _MACH_IOC(MACH_IOC_OUT, (g), (n), sizeof(t))
++#define _MACH_IOW(g,n,t) _MACH_IOC(MACH_IOC_IN, (g), (n), sizeof(t))
++#define _MACH_IOWR(g,n,t) _MACH_IOC(MACH_IOC_INOUT, (g), (n), sizeof(t))
++
++/* taken from gnumach-1.1.3/i386/i386at/kd.h */
++
++#define KDSKBDMODE _MACH_IOW('K', 1, int) /* set keyboard mode */
++#define KB_EVENT 1
++#define KB_ASCII 2
++
++#define KDGKBDTYPE _MACH_IOR('K', 2, int) /* get keyboard type */
++
++typedef unsigned short kev_type; /* kd event type */
++typedef unsigned char Scancode;
++/* (used for event records) */
++struct mouse_motion {
++ short mm_deltaX; /* units? */
++ short mm_deltaY;
++};
++
++typedef struct {
++ kev_type type; /* see below */
++ struct timeval time; /* timestamp */
++ union { /* value associated with event */
++ boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */
++ Scancode sc; /* KEYBD_EVENT */
++ struct mouse_motion mmotion; /* MOUSE_MOTION */
++ } value;
++} kd_event;
++
++
++/*
++ * kd_event ID's.
++ */
++#define MOUSE_LEFT 1 /* mouse left button up/down */
++#define MOUSE_MIDDLE 2
++#define MOUSE_RIGHT 3
++#define MOUSE_MOTION 4 /* mouse motion */
++#define KEYBD_EVENT 5 /* key up/down */
++
++/*
++ * Low 3 bits of minor are the com port #.
++ * The high 5 bits of minor are the mouse type
++ */
++#define MOUSE_SYSTEM_MOUSE 0
++#define MICROSOFT_MOUSE 1
++#define IBM_MOUSE 2
++#define NO_MOUSE 3
++#define LOGITECH_TRACKMAN 4
++#define MICROSOFT_MOUSE7 5
++
++
+--- hurd-20040301.orig/trans/Makefile
++++ hurd-20040301/trans/Makefile
+@@ -19,13 +19,15 @@
+ makemode := servers
+
+ targets = symlink firmlink ifsock magic null fifo new-fifo fwd crash \
+- password hello hello-mt streamio fakeroot proxy-defpager
++ password hello hello-mt streamio fakeroot proxy-defpager \
++ kbd mouse
+ SRCS = ifsock.c symlink.c magic.c null.c fifo.c new-fifo.c fwd.c \
+ crash.c firmlink.c password.c hello.c hello-mt.c streamio.c \
+- fakeroot.c proxy-defpager.c
++ fakeroot.c proxy-defpager.c kbd.c mouse.c
+ OBJS = $(SRCS:.c=.o) fsysServer.o ifsockServer.o passwordServer.o \
+ crashServer.o crash_replyUser.o msgServer.o \
+ default_pagerServer.o default_pagerUser.o \
++ kdioctlServer.o \
+ device_replyServer.o elfcore.o
+ HURDLIBS = threads ports trivfs fshelp pipe ihash shouldbeinlibc
+ password-LDLIBS = $(LIBCRYPT)
+@@ -40,6 +42,7 @@
+
+ symlink: fsysServer.o
+ ifsock: ifsockServer.o
++kbd: kdioctlServer.o
+ crash: crashServer.o crash_replyUser.o msgServer.o elfcore.o
+ password: passwordServer.o
+ streamio: device_replyServer.o
+@@ -48,7 +51,7 @@
+ proxy-defpager crash password streamio: ../libthreads/libthreads.a ../libports/libports.a ../libtrivfs/libtrivfs.a ../libthreads/libthreads.a ../libfshelp/libfshelp.a
+ fifo new-fifo: ../libpipe/libpipe.a
+ fwd: ../libfshelp/libfshelp.a ../libports/libports.a
+-hello-mt magic null ifsock fifo new-fifo firmlink: ../libtrivfs/libtrivfs.a ../libfshelp/libfshelp.a ../libthreads/libthreads.a ../libports/libports.a ../libihash/libihash.a
++kbd mouse hello-mt magic null ifsock fifo new-fifo firmlink: ../libtrivfs/libtrivfs.a ../libfshelp/libfshelp.a ../libthreads/libthreads.a ../libports/libports.a ../libihash/libihash.a
+ hello: ../libtrivfs/libtrivfs.a ../libfshelp/libfshelp.a ../libports/libports.a ../libihash/libihash.a
+ fakeroot: ../libnetfs/libnetfs.a ../libfshelp/libfshelp.a ../libiohelp/libiohelp.a ../libthreads/libthreads.a ../libports/libports.a ../libihash/libihash.a
+ $(targets): ../libshouldbeinlibc/libshouldbeinlibc.a
+--- hurd-20040301.orig/trans/kbd.c
++++ hurd-20040301/trans/kbd.c
+@@ -0,0 +1,306 @@
++/* A translator for kbd
++
++ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
++
++ Written by UCHIYAMA Yasushi <uch@nop.or.jp>
++
++ 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
++
++#include <hurd.h>
++#include <hurd/ports.h>
++#include <hurd/trivfs.h>
++#include <hurd/fsys.h>
++#include <version.h>
++
++#include <stdio.h>
++#include <unistd.h>
++#include <error.h>
++#include <string.h>
++#include <fcntl.h>
++#include <limits.h>
++#include <argp.h>
++
++
++#include <device/device.h>
++#include "kdioctl_S.h"
++#include "kd.h"
++
++#define KBD_BUF_SIZE 1
++static struct kbd_buffer
++{
++ mach_port_t port;
++ struct mutex lock;
++ struct condition fill;
++ struct condition notfull;
++ kd_event buf[KBD_BUF_SIZE];
++ int cnt;
++ int in;
++ int out;
++} kbd;
++
++static int
++demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
++{
++ extern int kdioctl_server (mach_msg_header_t *, mach_msg_header_t *);
++
++ return (trivfs_demuxer (inp, outp)
++ || kdioctl_server (inp, outp));
++}
++
++static any_t
++kbd_thread (any_t arg)
++{
++ for(;;)
++ {
++ kd_event *event;
++ vm_offset_t buf;
++ mach_msg_type_number_t buf_size;
++ int ncopy;
++ kern_return_t err;
++
++ err = device_read (kbd.port, 0, 0, sizeof (kd_event), (char **)&buf, &buf_size);
++ if (err)
++ return err;
++
++ mutex_lock (&kbd.lock);
++ while (kbd.cnt == KBD_BUF_SIZE)
++ condition_wait (&kbd.notfull, &kbd.lock);
++ ncopy = buf_size / sizeof (kd_event);
++ if (KBD_BUF_SIZE - kbd.cnt < ncopy)
++ ncopy = KBD_BUF_SIZE - kbd.cnt;
++ event = (kd_event*)buf;
++ while (ncopy)
++ {
++ kbd.buf[kbd.in] = *event++;
++ kbd.in = (kbd.in + 1) % KBD_BUF_SIZE;
++ kbd.cnt++;
++ ncopy--;
++ }
++ vm_deallocate (mach_task_self(), buf, buf_size);
++ condition_broadcast (&kbd.fill);
++ mutex_unlock (&kbd.lock);
++ }
++}
++
++/**********************************************************************
++ *open(2), close(2)
++ **********************************************************************/
++static error_t
++open_hook (struct trivfs_peropen *po)
++{
++ kern_return_t err = 0;
++ mach_port_t master;
++
++ mutex_lock (&kbd.lock);
++
++ if (po->openmodes & O_READ)
++ {
++ if( kbd.port != MACH_PORT_NULL)
++ return EBUSY;
++ err = get_privileged_ports (NULL, &master);
++ if (err)
++ return err;
++ err = device_open (master, D_READ, "kbd" , &kbd.port);
++ mach_port_deallocate (mach_task_self(), master);
++ }
++ kbd.cnt = 0;
++ cthread_detach (cthread_fork (kbd_thread, 0));
++ mutex_unlock (&kbd.lock);
++ return err;
++}
++
++static void
++close_hook (struct trivfs_peropen *po)
++{
++ int cnt = 1;
++ int mode = KB_ASCII;
++
++ device_set_status (kbd.port, KDSKBDMODE, (dev_status_t)&mode, cnt);
++ device_close (kbd.port);
++ kbd.port = MACH_PORT_NULL;
++}
++
++/* Trivfs hooks */
++
++error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) = open_hook;
++void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
++
++int
++main (int argc, char **argv)
++{
++ error_t err;
++ mach_port_t bootstrap;
++ struct trivfs_control *fsys;
++
++ task_get_bootstrap_port (mach_task_self (), &bootstrap);
++ if (bootstrap == MACH_PORT_NULL)
++ error(1, 0, "Must be started as a translator");
++
++ /* Reply to our parent */
++ err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
++ if (err)
++ error(3, err, "Contacting parent");
++ /* Launch. */
++ mutex_init( &kbd.lock );
++ ports_manage_port_operations_multithread (fsys->pi.bucket,demuxer,2 * 60 * 1000, 0, 0);
++
++ exit(0);
++}
++
++/* Trivfs hooks */
++
++int trivfs_fstype = FSTYPE_DEV;
++int trivfs_fsid = 0;
++
++int trivfs_support_read = 1;
++int trivfs_support_write = 0;
++int trivfs_support_exec = 0;
++
++int trivfs_allow_open = O_READ;
++
++void
++trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
++{
++ st->st_blksize = vm_page_size * 256; /* Make transfers LARRRRRGE */
++
++ st->st_size = 0;
++ st->st_blocks = 0;
++
++ st->st_mode &= ~S_IFMT;
++ st->st_mode |= S_IFCHR;
++}
++
++error_t
++trivfs_goaway (struct trivfs_control *fsys, int flags)
++{
++ exit (0);
++}
++/***********************************************************************
++ * read(2), select(2)
++ ***********************************************************************/
++/* Read data from an IO object. If offset if -1, read from the object
++ maintained file pointer. If the object is not seekable, offset is
++ ignored. The amount desired to be read is in AMT. */
++kern_return_t
++trivfs_S_io_read(struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t replytype,
++ data_t *data,
++ mach_msg_type_number_t *datalen,
++ loff_t offs,
++ vm_size_t amt)
++{
++ int i,n;
++ if (!cred)
++ return EOPNOTSUPP;
++ else if (!(cred->po->openmodes & O_READ))
++ return EBADF;
++
++ mutex_lock (&kbd.lock);
++ while (!kbd.cnt)
++ {
++ if (cred->po->openmodes & O_NONBLOCK)
++ {
++ mutex_unlock (&kbd.lock);
++ return EWOULDBLOCK;
++ }
++ if (hurd_condition_wait (&kbd.fill, &kbd.lock))
++ {
++ mutex_unlock (&kbd.lock);
++ return EINTR;
++ }
++ }
++ if ((n = amt / sizeof (kd_event)) > kbd.cnt)
++ n = kbd.cnt;
++ for (i = 0; i < n ; i++)
++ {
++ (*(kd_event **)data)[i] = kbd.buf[kbd.out];
++ kbd.out = (kbd.out + 1) % KBD_BUF_SIZE;
++ kbd.cnt--;
++ }
++ *datalen = n * sizeof (kd_event);
++ if (n)
++ condition_signal (&kbd.notfull);
++ mutex_unlock (&kbd.lock);
++ return 0;
++}
++
++/* SELECT_TYPE is the bitwise OR of SELECT_READ, SELECT_WRITE, and SELECT_URG.
++ Block until one of the indicated types of i/o can be done "quickly", and
++ return the types that are then available. ID_TAG is returned as passed; it
++ is just for the convenience of the user in matching up reply messages with
++ specific requests sent. */
++
++kern_return_t
++trivfs_S_io_select (struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t replytype,
++ int *type)
++{
++ if (!cred)
++ return EOPNOTSUPP;
++ if(*type & ~SELECT_READ )
++ return EINVAL;
++
++ mutex_lock (&kbd.lock);
++ while (1)
++ {
++ if (kbd.cnt)
++ {
++ *type = SELECT_READ;
++ mutex_unlock (&kbd.lock);
++ return 0;
++ }
++ ports_interrupt_self_on_port_death (cred, reply);
++ if (hurd_condition_wait (&kbd.fill, &kbd.lock))
++ {
++ *type = 0;
++ mutex_unlock (&kbd.lock);
++ return EINTR;
++ }
++ }
++}
++/***********************************************************************
++ * ioctl(2)
++***********************************************************************/
++kern_return_t
++S_kdioctl_kdskbdmode( io_t port,int mode )
++{
++ kern_return_t err;
++ int cnt = 1;
++ err = device_set_status (kbd.port, KDSKBDMODE, (dev_status_t)&mode, cnt);
++ return err;
++}
++
++kern_return_t
++S_kdioctl_kdgkbdmode( io_t port,int *mode )
++{
++ kern_return_t err;
++ int cnt;
++
++ err = device_get_status (kbd.port, KDGKBDTYPE, (dev_status_t)mode, &cnt);
++ return err;
++}
++
++kern_return_t
++S_kdioctl_kdkdsetled( io_t port,int mode )
++{
++ return EOPNOTSUPP; /* XXX */
++}
++
++kern_return_t
++S_kdioctl_kdkdgetled( io_t port,int *mode )
++{
++ return EOPNOTSUPP; /* XXX */
++}
++
+--- hurd-20040301.orig/trans/mouse.c
++++ hurd-20040301/trans/mouse.c
+@@ -0,0 +1,318 @@
++/* A translator for mouse.
++
++ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
++
++ Written by UCHIYAMA Yasushi <uch@nop.or.jp>
++
++ 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
++
++#include <hurd.h>
++#include <hurd/ports.h>
++#include <hurd/trivfs.h>
++#include <hurd/fsys.h>
++#include <version.h>
++
++#include <stdio.h>
++#include <unistd.h>
++#include <error.h>
++#include <string.h>
++#include <fcntl.h>
++#include <limits.h>
++#include <argp.h>
++
++const char *argp_program_version = STANDARD_HURD_VERSION (mouse);
++
++#include <device/device.h>
++#include "kd.h"
++
++static char *arg_mouse_protocol,*arg_mouse_device;
++static char mouse_device_name[16];
++
++#define MOUSE_BUF_SIZE 64
++static struct mouse_buffer
++{
++ mach_port_t port;
++ struct mutex lock;
++ struct condition fill;
++ struct condition notfull;
++ kd_event buf[MOUSE_BUF_SIZE];
++ int cnt;
++ int in;
++ int out;
++} mouse;
++
++/* mouse options. Used for startup */
++static const struct argp_option options[] =
++{
++ {"protocol", 'p' ,"PROTOCOL", 0, "mouse PROTOCOL(ps/2,microsoft etc..."},
++ {"device", 'd' ,"DEVICE" , 0, "mouse DEVICE (com0,com1,none)"},
++ {0,0}
++};
++
++static error_t
++parse_opt (int key, char *arg, struct argp_state *state)
++{
++ switch (key)
++ {
++ case 'p': arg_mouse_protocol = arg ; break;
++ case 'd': arg_mouse_device = arg ; break;
++ default:
++ return ARGP_ERR_UNKNOWN;
++ }
++ return 0;
++}
++
++static int
++set_mouse_device_name()
++{
++ /* See gnumach/i386/i386at/kd_mouse.c */
++ struct {
++ int type;
++ char *name;
++ } mouse_tab[] = {
++ { MOUSE_SYSTEM_MOUSE, "mousesystem"},
++ { MICROSOFT_MOUSE, "microsoft" },
++ { IBM_MOUSE, "ps/2" },
++ { NO_MOUSE, "nomouse" },
++ { LOGITECH_TRACKMAN, "logitech" },
++ { MICROSOFT_MOUSE7, "mouse7" },
++ };
++ int i,n = sizeof mouse_tab / sizeof (mouse_tab[0]);
++ for (i = 0; i < n; i++)
++ if (!strcmp (mouse_tab[i].name, arg_mouse_protocol))
++ {
++ int type, unit, device_minor;
++ type = mouse_tab[i].type;
++ if (arg_mouse_device && !strcmp (arg_mouse_device, "com1"))
++ unit = 1;
++ else
++ unit = 0;
++ device_minor = 0;
++ device_minor |= (type<<3);
++ device_minor |= unit;
++ device_minor = device_minor % 100;
++
++ sprintf (mouse_device_name, "mouse%d", device_minor);
++ return 1;
++ }
++ return 0;
++}
++
++int
++main (int argc, char **argv)
++{
++ error_t err;
++ mach_port_t bootstrap;
++ struct trivfs_control *fsys;
++
++ const struct argp argp = { options , parse_opt };
++
++ if(argp_parse (&argp, argc, argv, 0, 0, 0) )
++ error(1, 0, "argp_parse failed.");
++
++ set_mouse_device_name();
++
++ task_get_bootstrap_port (mach_task_self (), &bootstrap);
++ if (bootstrap == MACH_PORT_NULL)
++ error(1, 0, "Must be started as a translator");
++
++ /* Reply to our parent */
++ err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
++ if (err)
++ error(3, err, "Contacting parent");
++ /* Launch. */
++ mutex_init (&mouse.lock);
++ ports_manage_port_operations_multithread (fsys->pi.bucket,trivfs_demuxer, 2 * 60 * 1000, 0, 0);
++
++ exit(0);
++}
++
++static any_t
++mouse_thread (any_t arg)
++{
++ for(;;)
++ {
++ kd_event *event;
++ vm_offset_t buf;
++ mach_msg_type_number_t buf_size;
++ int ncopy;
++ kern_return_t err;
++
++ err = device_read (mouse.port, 0, 0, sizeof (kd_event), (char **)&buf, &buf_size);
++ if (err)
++ return err;
++
++ mutex_lock (&mouse.lock);
++ while (mouse.cnt == MOUSE_BUF_SIZE)
++ condition_wait (&mouse.notfull, &mouse.lock);
++ ncopy = buf_size / sizeof (kd_event);
++ if (MOUSE_BUF_SIZE - mouse.cnt < ncopy )
++ ncopy = MOUSE_BUF_SIZE - mouse.cnt;
++ event = (kd_event*)buf;
++ while (ncopy--)
++ {
++ mouse.buf[mouse.in] = *event++;
++ mouse.in = (mouse.in + 1) % MOUSE_BUF_SIZE;
++ mouse.cnt++;
++ }
++ vm_deallocate (mach_task_self(), buf, buf_size);
++ condition_broadcast (&mouse.fill);
++ mutex_unlock (&mouse.lock);
++ }
++}
++
++static error_t
++open_hook (struct trivfs_peropen *po)
++{
++ kern_return_t err = 0;
++ mach_port_t master;
++ mutex_lock (&mouse.lock);
++ if (po->openmodes & O_READ)
++ {
++ if( mouse.port )
++ return EBUSY;
++ err = get_privileged_ports( NULL, &master );
++ if( err )
++ return err;
++ err = device_open (master, D_READ, mouse_device_name, &mouse.port);
++ mach_port_deallocate (mach_task_self(), master);
++ }
++ mouse.cnt = 0;
++ cthread_detach (cthread_fork (mouse_thread, 0));
++ mutex_unlock (&mouse.lock);
++ return err;
++}
++
++static void
++close_hook (struct trivfs_peropen *po)
++{
++ device_close (mouse.port);
++ mouse.port = (mach_port_t)NULL;
++}
++
++/* Trivfs hooks */
++
++error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) = open_hook;
++void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
++
++int trivfs_fstype = FSTYPE_DEV;
++int trivfs_fsid = 0;
++
++int trivfs_support_read = 1;
++int trivfs_support_write = 0;
++int trivfs_support_exec = 0;
++
++int trivfs_allow_open = O_READ | O_WRITE;
++
++void
++trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
++{
++ st->st_blksize = vm_page_size * 256; /* Make transfers LARRRRRGE */
++
++ st->st_size = 0;
++ st->st_blocks = 0;
++
++ st->st_mode &= ~S_IFMT;
++ st->st_mode |= S_IFCHR;
++}
++
++error_t
++trivfs_goaway (struct trivfs_control *fsys, int flags)
++{
++ exit (0);
++}
++
++/* Read data from an IO object. If offset if -1, read from the object
++ maintained file pointer. If the object is not seekable, offset is
++ ignored. The amount desired to be read is in AMT. */
++kern_return_t
++trivfs_S_io_read(struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t replytype,
++ data_t *data,
++ mach_msg_type_number_t *datalen,
++ loff_t offs,
++ vm_size_t amt)
++{
++ int i,n;
++ if (!cred)
++ return EOPNOTSUPP;
++ else if (!(cred->po->openmodes & O_READ))
++ return EBADF;
++
++ mutex_lock (&mouse.lock);
++ while (!mouse.cnt)
++ {
++ if (cred->po->openmodes & O_NONBLOCK)
++ {
++ mutex_unlock (&mouse.lock);
++ return EWOULDBLOCK;
++ }
++ if (hurd_condition_wait (&mouse.fill, &mouse.lock))
++ {
++ mutex_unlock (&mouse.lock);
++ return EINTR;
++ }
++ }
++ if ((n = amt / sizeof (kd_event)) > mouse.cnt)
++ n = mouse.cnt;
++ for (i = 0; i < n; i++)
++ {
++ (*(kd_event **)data)[i] = mouse.buf[mouse.out];
++ mouse.out = (mouse.out + 1 ) % MOUSE_BUF_SIZE;
++ mouse.cnt--;
++ }
++ *datalen = n * sizeof (kd_event);
++ if (n)
++ condition_signal (&mouse.notfull);
++ mutex_unlock (&mouse.lock);
++ return 0;
++}
++
++
++/* SELECT_TYPE is the bitwise OR of SELECT_READ, SELECT_WRITE, and SELECT_URG.
++ Block until one of the indicated types of i/o can be done "quickly", and
++ return the types that are then available. ID_TAG is returned as passed; it
++ is just for the convenience of the user in matching up reply messages with
++ specific requests sent. */
++
++kern_return_t
++trivfs_S_io_select (struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t replytype,
++ int *type)
++{
++ if (!cred)
++ return EOPNOTSUPP;
++ if(*type & ~SELECT_READ )
++ return EINVAL;
++
++ mutex_lock (&mouse.lock);
++ while (1)
++ {
++ if (mouse.cnt)
++ {
++ *type = SELECT_READ;
++ mutex_unlock (&mouse.lock);
++ return 0;
++ }
++ ports_interrupt_self_on_port_death (cred, reply);
++ if (hurd_condition_wait (&mouse.fill, &mouse.lock))
++ {
++ *type = 0;
++ mutex_unlock (&mouse.lock);
++ return EINTR;
++ }
++ }
++}
++
diff --git a/debian/patches/console_switch3.patch b/debian/patches/console_switch3.patch
new file mode 100644
index 00000000..13c090d3
--- /dev/null
+++ b/debian/patches/console_switch3.patch
@@ -0,0 +1,839 @@
+2004-04-01 Marco Gerards <metgerards@student.han.nl>
+
+ * Makefile (LCLHDRS): Add inputdev.h.
+ (pc_kbd.so.$(hurd-version)): Add kdioctlServer.o kbd-repeat.c.
+ (pc_kbd-LDLIBS): New variable.
+ * console.c (saved_id): New variable.
+ (saved_cons): Likewise.
+ (console_switch_away): New function.
+ (console_switch_back): Likewise.
+ * input.h (console_switch_away): New prototype.
+ (console_switch_back): Likewise.
+ * pc-kbd.c: Include "inputdev.h" and <argp.h>.
+ (repeater_node): New variable.
+ (doc): Likewise.
+ (options): Likewise.
+ (argp): Likewise.
+ (parse_opt): New function.
+ (pc_kbd_init): Parse the arguments.
+ (gnumach_v1_input_next): Pass the keyboard event to the repeater
+ if the repeater is active.
+ (pc_kbd_init): Parse the `--repeat' argument.
+ (pc_kbd_start): If a repeater node was specified, start it as a
+ translator on the given node.
+ (kev_type, mouse_motion, mouse_motion, Scancode, m_deltaX)
+ (m_deltaY, MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT, MOUSE_MOTION)
+ (MOUSE_EVENT, IOCPARM_MASK, IOC_OUT, IOC_IN, _IOC, _IOR, _IOW)
+ (KDSKBDMODE, KB_EVENT, KB_ASCII, KDFKBDTYPE, KB_VANILLAKB)
+ (KB_EVENT, KBSETLEDS): Move from here...
+ * inputdev.h: ... to here. New file.
+ * kbd-repeat.c: New file.
+
+
+
+diff -upN ../../console-client/Makefile ./Makefile
+--- ../../console-client/Makefile 2002-09-17 14:26:10.000000000 +0200
++++ console-client/Makefile 2004-03-28 10:53:06.000000000 +0200
+@@ -21,7 +21,7 @@ makemode := utility
+ target = console
+ SRCS = console.c timer.c driver.c
+ LCLHDRS = timer.h driver.h display.h input.h bell.h \
+- unicode.h bdf.h \
++ unicode.h bdf.h inputdev.h \
+ vga-dynafont.h vga-dynacolor.h vga-hw.h vga.h
+
+ OBJS = $(filter-out %.sh,$(SRCS:.c=.o))
+@@ -45,7 +45,9 @@ modules = vga pc_kbd generic_speaker
+
+ vga.so.$(hurd-version): $(patsubst %.c,%_pic.o,bdf.c vga-dynafont.c \
+ vga-dynacolor.c vga-support.c vga.c)
+-pc_kbd.so.$(hurd-version): $(patsubst %.c,%_pic.o,pc-kbd.c)
++pc_kbd.so.$(hurd-version): $(patsubst %.c,%_pic.o,pc-kbd.c kdioctlServer.o kbd-repeat.c)
++pc_kbd-LDLIBS = -ltrivfs
++
+ generic_speaker.so.$(hurd-version): $(patsubst %.c,%_pic.o,generic-speaker.c)
+
+ ifneq ($(LIBNCURSESW),)
+diff -upN ../../console-client/console.c ./console.c
+--- ../../console-client/console.c 2004-03-24 23:53:17.000000000 +0100
++++ console-client/console.c 2004-03-28 11:10:42.000000000 +0200
+@@ -47,6 +47,12 @@ static struct mutex global_lock;
+ displayed. */
+ static vcons_t active_vcons = NULL;
+
++/* Contains the VT id when switched away. */
++static int saved_id = 0;
++
++/* The console, used to switch back. */
++static cons_t saved_cons;
++
+
+ /* Callbacks for input source drivers. */
+
+@@ -94,6 +100,53 @@ console_switch (int id, int delta)
+ }
+
+
++/* Switch away from the console an external use of the console like
++ XFree. */
++void
++console_switch_away (void)
++{
++ mutex_lock (&global_lock);
++ saved_id = active_vcons->id;
++ saved_cons = active_vcons->cons;
++ cons_vcons_close (active_vcons);
++ active_vcons = NULL;
++ mutex_unlock (&global_lock);
++}
++
++/* Switch back to the console client from an external user of the
++ console like XFree. */
++void
++console_switch_back (void)
++{
++ vcons_list_t conslist;
++ mutex_lock (&global_lock);
++ if (saved_cons)
++ {
++ error_t err;
++
++ err = cons_lookup (saved_cons, saved_id, 1, &conslist);
++ if (err)
++ {
++ mutex_unlock (&global_lock);
++ return;
++ }
++
++ err = cons_vcons_open (saved_cons, conslist, &active_vcons);
++ if (err)
++ {
++ mutex_unlock (&global_lock);
++ return;
++ }
++
++ conslist->vcons = active_vcons;
++ saved_cons = NULL;
++ mutex_unlock (&active_vcons->lock);
++ }
++ mutex_unlock (&global_lock);
++}
++
++
++
+ /* Enter SIZE bytes from the buffer BUF into the currently active
+ console. This can be called by the input driver at any time. */
+ error_t
+diff -upN ../../console-client/input.h ./input.h
+--- ../../console-client/input.h 2002-09-17 14:26:10.000000000 +0200
++++ console-client/input.h 2004-03-28 10:53:13.000000000 +0200
+@@ -1,5 +1,5 @@
+ /* input.h - The interface to and for an input driver.
+- Copyright (C) 2002 Free Software Foundation, Inc.
++ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Written by Marcus Brinkmann.
+
+ This file is part of the GNU Hurd.
+@@ -65,6 +65,15 @@ void console_error (const wchar_t *const
+ /* Exit the console client. Does not return. */
+ void console_exit (void);
+
++/* Switch away from the console an external use of the console like
++ XFree. */
++void console_switch_away (void);
++
++/* Switch back to the console client from an external user of the
++ console like XFree. */
++void console_switch_back (void);
++
++
+ #if QUAERENDO_INVENIETIS
+ /* Do not use, do not remove. */
+ void console_deprecated (int key);
+diff -upN ../../console-client/inputdev.h ./inputdev.h
+--- ../../console-client/inputdev.h 1970-01-01 01:00:00.000000000 +0100
++++ console-client/inputdev.h 2004-03-28 10:53:13.000000000 +0200
+@@ -0,0 +1,122 @@
++/* inputdev.h - Interfaces for the PC pc-kbd and mouse input drivers.
++ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
++ Written by Marco Gerards.
++
++ This file is part of the GNU Hurd.
++
++ The GNU Hurd is free software; you can redistribute it and/or
++ modify it under the terms of the GNU General Public License as
++ published by the Free Software Foundation; either version 2, or (at
++ your option) any later version.
++
++ The GNU Hurd 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, USA. */
++
++/* This gross stuff is cut & pasted from Mach sources, as Mach doesn't
++ export the interface we are using here. */
++
++/*
++ * Mach Operating System
++ * Copyright (c) 1991,1990,1989 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 Mellon
++ * the rights to redistribute these changes.
++ */
++
++#ifndef _INPUTDEV_H_
++#define _INPUTDEV_H_ 1
++
++typedef u_short kev_type; /* kd event type */
++
++/* (used for event records) */
++struct mouse_motion {
++ short mm_deltaX; /* units? */
++ short mm_deltaY;
++};
++typedef u_char Scancode;
++
++typedef struct {
++ kev_type type; /* see below */
++ struct timeval time; /* timestamp */
++ union { /* value associated with event */
++ boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */
++ Scancode sc; /* KEYBD_EVENT */
++ struct mouse_motion mmotion; /* MOUSE_MOTION */
++ } value;
++} kd_event;
++#define m_deltaX mmotion.mm_deltaX
++#define m_deltaY mmotion.mm_deltaY
++
++/*
++ * kd_event ID's.
++ */
++#define MOUSE_LEFT 1 /* mouse left button up/down */
++#define MOUSE_MIDDLE 2
++#define MOUSE_RIGHT 3
++#define MOUSE_MOTION 4 /* mouse motion */
++#define KEYBD_EVENT 5 /* key up/down */
++
++
++#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
++#define IOC_OUT 0x40000000 /* copy out parameters */
++#define IOC_IN 0x80000000U /* copy in parameters */
++
++#ifndef _IOC
++#define _IOC(inout,group,num,len) \
++ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
++#endif
++#ifndef _IOR
++#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
++#endif
++#ifndef _IOW
++#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
++#endif
++
++#define KDSKBDMODE _IOW('K', 1, int) /* set keyboard mode */
++#define KB_EVENT 1
++#define KB_ASCII 2
++
++#define KDGKBDTYPE _IOR('K', 2, int) /* get keyboard type */
++#define KB_VANILLAKB 0
++
++#define KDSETLEDS _IOW('K', 5, int) /* set keyboard leds */
++
++
++/* End of Mach code. */
++
++
++/* Amount of times the device was opened. Normally this translator
++ should be only opened once. */
++extern int kbd_repeater_opened;
++
++/* Place the keyboard event KEY in the keyboard buffer. */
++void repeat_key (kd_event *key);
++
++/* Set the repeater translator on the node PATH. */
++error_t setrepeater (const char *path);
++
++#endif /* _INPUTDEV_H_ */
+diff -upN ../../console-client/kbd-repeat.c ./kbd-repeat.c
+--- ../../console-client/kbd-repeat.c 1970-01-01 01:00:00.000000000 +0100
++++ console-client/kbd-repeat.c 2004-04-01 03:22:46.000000000 +0200
+@@ -0,0 +1,357 @@
++/* kbd-repeat.c - Keyboard repeater.
++ Copyright (C) 2004 Free Software Foundation, Inc.
++ Written by Marco Gerards.
++
++ This file is part of the GNU Hurd.
++
++ The GNU Hurd is free software; you can redistribute it and/or
++ modify it under the terms of the GNU General Public License as
++ published by the Free Software Foundation; either version 2, or (at
++ your option) any later version.
++
++ The GNU Hurd 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, USA. */
++
++
++#include <hurd/trivfs.h>
++#include <stdlib.h>
++#include <error.h>
++#include <string.h>
++#include <fcntl.h>
++#include <sys/mman.h>
++
++#include "kdioctl_S.h"
++#include "inputdev.h"
++#include "input.h"
++
++/* The amount of keyboard events that can be stored in the keyboard buffer. */
++#define KBDEVTBUFSZ 20
++
++/* The size of the keyboard buffer in bytes. */
++#define KBDBUFSZ (KBDEVTBUFSZ * sizeof (kd_event))
++
++/* Return the position of X in the buffer. */
++#define KBDBUF_POS(x) ((x) % KBDBUFSZ)
++
++/* The keyboard buffer. */
++struct kbdbuf
++{
++ char keybuffer[KBDBUFSZ];
++ int pos;
++ size_t size;
++ struct condition readcond;
++ struct condition writecond;
++} kbdbuf;
++
++/* Wakeup for select */
++static struct condition select_alert;
++
++/* The global lock */
++static struct mutex global_lock;
++
++/* Bucket to handle the keyboard RPCs. */
++static struct port_bucket *kbdbucket;
++
++/* Amount of times the device was opened. Normally this translator
++ should be only opened once. */
++int kbd_repeater_opened;
++
++
++static int
++kdioctl_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
++{
++ extern int kdioctl_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
++ return kdioctl_server (inp, outp) || trivfs_demuxer (inp, outp);
++}
++
++
++/* Place the keyboard event KEY in the keyboard buffer. */
++void
++repeat_key (kd_event *key)
++{
++ kd_event *ev;
++
++ mutex_lock (&global_lock);
++ while (kbdbuf.size + sizeof (kd_event) > KBDBUFSZ)
++ {
++ /* The input buffer is full, wait until there is some space. */
++ if (hurd_condition_wait (&kbdbuf.writecond, &global_lock))
++ {
++ mutex_unlock (&global_lock);
++ /* Interrupt, silently continue. */
++ }
++ }
++ ev = (kd_event *) &kbdbuf.keybuffer[KBDBUF_POS (kbdbuf.pos
++ + kbdbuf.size)];
++ kbdbuf.size += sizeof (kd_event);
++ memcpy (ev, key, sizeof (kd_event));
++ condition_broadcast (&kbdbuf.readcond);
++ mutex_unlock (&global_lock);
++}
++
++
++/* Thread to handle operations on the kbdbucket. */
++static any_t
++repeater_translator_function (void *arg)
++{
++ ports_manage_port_operations_one_thread (kbdbucket, kdioctl_demuxer, 0);
++ return 0;
++}
++
++
++/* Set the repeater translator on the node PATH. */
++error_t
++setrepeater (const char *path)
++{
++ error_t err;
++ struct trivfs_control *control;
++ file_t node;
++
++ kbdbucket = ports_create_bucket ();
++
++ node = file_name_lookup (path, O_CREAT|O_NOTRANS, 0664);
++ if (node == MACH_PORT_NULL)
++ return errno;
++
++ err = trivfs_create_control (node, 0, kbdbucket, 0, kbdbucket, &control);
++ if (! err)
++ {
++ mach_port_t right = ports_get_send_right (control);
++ err = file_set_translator (node, 0, FS_TRANS_EXCL | FS_TRANS_SET, 0, 0, 0,
++ right, MACH_MSG_TYPE_COPY_SEND);
++ mach_port_deallocate (mach_task_self (), right);
++ }
++ else
++ return err;
++
++ mutex_init (&global_lock);
++
++ condition_init (&kbdbuf.readcond);
++ condition_init (&kbdbuf.writecond);
++
++ condition_init (&select_alert);
++ condition_implies (&kbdbuf.readcond, &select_alert);
++
++ cthread_detach (cthread_fork (repeater_translator_function, 0));
++
++ return 0;
++}
++
++
++/* Just act like the Mach kbd device. */
++int trivfs_fstype = FSTYPE_DEV;
++int trivfs_fsid = 0;
++
++int trivfs_allow_open = O_READ;
++
++int trivfs_support_read = 1;
++int trivfs_support_write = 0;
++int trivfs_support_exec = 0;
++
++error_t
++trivfs_S_io_select (struct trivfs_protid *cred, mach_port_t reply,
++ mach_msg_type_name_t reply_type, int *type)
++{
++ int available = 0;
++
++ if (!cred)
++ return EOPNOTSUPP;
++
++ if (*type & ~SELECT_READ)
++ return EINVAL;
++
++ if (*type == 0)
++ return 0;
++
++ available = 0;
++
++ mutex_lock (&global_lock);
++ while (1)
++ {
++ if (available && kbdbuf.size > 0)
++ {
++ *type = SELECT_READ;
++ mutex_unlock (&global_lock);
++
++ return 0;
++ }
++
++ if (cred->po->openmodes & O_NONBLOCK)
++ {
++ mutex_unlock (&global_lock);
++
++ return EWOULDBLOCK;
++ }
++
++ ports_interrupt_self_on_port_death (cred, reply);
++ if (hurd_condition_wait (&select_alert, &global_lock))
++ {
++ *type = 0;
++ mutex_unlock (&global_lock);
++
++ return EINTR;
++ }
++ }
++}
++
++
++void
++trivfs_modify_stat (struct trivfs_protid *cred, io_statbuf_t *st)
++{
++ /* Mark the node as a read-only plain file. */
++ st->st_mode &= ~(S_IFMT);
++ st->st_mode |= (S_IRUSR | S_IFCHR);
++
++ st->st_size = 0;
++ st->st_blocks = 0;
++
++}
++
++
++/* No one wants this. Use the console client to terminate the console
++ client or send a signal. */
++error_t
++trivfs_goaway (struct trivfs_control *cntl, int flags)
++{
++ return EOPNOTSUPP;
++}
++
++
++static error_t
++open_hook (struct trivfs_peropen *peropen)
++{
++ /* Make sure the console does not access the hardware anymore. */
++ if (! kbd_repeater_opened)
++ console_switch_away ();
++ kbd_repeater_opened++;
++
++ return 0;
++}
++
++
++static void
++close_hook (struct trivfs_peropen *peropen)
++{
++ kbd_repeater_opened--;
++
++ /* Allow the console to access the hardware again. */
++ if (! kbd_repeater_opened)
++ {
++ console_switch_back ();
++ kbdbuf.pos = 0;
++ kbdbuf.size = 0;
++
++ }
++}
++
++
++/* Read data from an IO object. If offset is -1, read from the object
++ maintained file pointer. If the object is not seekable, offset is
++ ignored. The amount desired to be read is in AMOUNT. */
++error_t
++trivfs_S_io_read (struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t reply_type,
++ char **data, mach_msg_type_number_t *data_len,
++ loff_t offs, mach_msg_type_number_t amount)
++{
++ /* Deny access if they have bad credentials. */
++ if (! cred)
++ return EOPNOTSUPP;
++ else if (! (cred->po->openmodes & O_READ))
++ return EBADF;
++
++
++ mutex_lock (&global_lock);
++ while (amount > kbdbuf.size)
++ {
++ if (cred->po->openmodes & O_NONBLOCK && amount > kbdbuf.size)
++ {
++ mutex_unlock (&global_lock);
++ return EWOULDBLOCK;
++ }
++
++ if (hurd_condition_wait (&kbdbuf.readcond, &global_lock))
++ {
++ mutex_unlock (&global_lock);
++ return EINTR;
++ }
++ }
++
++ if (amount > 0)
++ {
++ char *keydata;
++ unsigned int i = 0;
++
++ /* Allocate a buffer when this is required. */
++ if (*data_len < amount)
++ {
++ *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
++ if (*data == MAP_FAILED)
++ {
++ mutex_unlock (&global_lock);
++ return ENOMEM;
++ }
++ }
++
++ /* Copy the bytes to the user's buffer and remove them from the
++ keyboard buffer. */
++ keydata = *data;
++ while (i != amount)
++ {
++ keydata[i++] = kbdbuf.keybuffer[kbdbuf.pos++];
++ kbdbuf.pos = KBDBUF_POS (kbdbuf.pos);
++ }
++ kbdbuf.size -= amount;
++ condition_broadcast (&kbdbuf.writecond);
++ }
++
++ *data_len = amount;
++ mutex_unlock (&global_lock);
++
++ return 0;
++}
++
++
++/* Change current read/write offset */
++error_t
++trivfs_S_io_seek (struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t reply_type,
++ off_t offs, int whence, off_t *new_offs)
++{
++ if (!cred)
++ return EOPNOTSUPP;
++ else
++ return ESPIPE;
++}
++
++
++/* If this variable is set, it is called every time a new peropen
++ structure is created and initialized. */
++error_t (*trivfs_peropen_create_hook)(struct trivfs_peropen *) = open_hook;
++
++/* If this variable is set, it is called every time a peropen structure
++ is about to be destroyed. */
++void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
++
++
++/* Some RPC calls for controlling the keyboard. These calls are just
++ ignored and just exist to make XFree happy. */
++
++kern_return_t
++S_kdioctl_kdskbdmode (io_t port, int mode)
++{
++ return 0;
++}
++
++
++kern_return_t
++S_kdioctl_kdgkbdmode (io_t port, int *mode)
++{
++ return 0;
++}
+diff -upN ../../console-client/pc-kbd.c ./pc-kbd.c
+--- ../../console-client/pc-kbd.c 2004-02-02 22:25:10.000000000 +0100
++++ console-client/pc-kbd.c 2004-03-28 11:35:46.000000000 +0200
+@@ -23,6 +23,7 @@
+ #include <string.h>
+ #include <iconv.h>
+ #include <sys/mman.h>
++#include <argp.h>
+
+ #include <device/device.h>
+ #include <cthreads.h>
+@@ -31,6 +32,7 @@
+ #include <hurd/cons.h>
+
+ #include "driver.h"
++#include "inputdev.h"
+
+
+ /* The keyboard device in the kernel. */
+@@ -52,6 +54,10 @@ int gnumach_v1_compat;
+ /* Forward declaration. */
+ static struct input_ops pc_kbd_ops;
+
++
++/* The node on which the repeater translator is set. */
++static char *repeater_node;
++
+
+ /* A list of scan codes generated by the keyboard, in the set 2 encoding. */
+ enum scancode
+@@ -558,87 +564,6 @@ enum scancode sc_set1_to_set2_x1[] =
+ SC_X1_DEL
+ };
+
+-
+-/* This gross stuff is cut & pasted from Mach sources, as Mach doesn't
+- export the interface we are using here. */
+-
+-/*
+- * Mach Operating System
+- * Copyright (c) 1991,1990,1989 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 Mellon
+- * the rights to redistribute these changes.
+- */
+-
+-typedef u_short kev_type; /* kd event type */
+-
+-/* (used for event records) */
+-struct mouse_motion {
+- short mm_deltaX; /* units? */
+- short mm_deltaY;
+-};
+-typedef u_char Scancode;
+-
+-typedef struct {
+- kev_type type; /* see below */
+- struct timeval time; /* timestamp */
+- union { /* value associated with event */
+- boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */
+- Scancode sc; /* KEYBD_EVENT */
+- struct mouse_motion mmotion; /* MOUSE_MOTION */
+- } value;
+-} kd_event;
+-#define m_deltaX mmotion.mm_deltaX
+-#define m_deltaY mmotion.mm_deltaY
+-
+-/*
+- * kd_event ID's.
+- */
+-#define MOUSE_LEFT 1 /* mouse left button up/down */
+-#define MOUSE_MIDDLE 2
+-#define MOUSE_RIGHT 3
+-#define MOUSE_MOTION 4 /* mouse motion */
+-#define KEYBD_EVENT 5 /* key up/down */
+-
+-
+-#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
+-#define IOC_OUT 0x40000000 /* copy out parameters */
+-#define IOC_IN 0x80000000U /* copy in parameters */
+-#define _IOC(inout,group,num,len) \
+- (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
+-#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
+-#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
+-
+-#define KDSKBDMODE _IOW('K', 1, int) /* set keyboard mode */
+-#define KB_EVENT 1
+-#define KB_ASCII 2
+-
+-#define KDGKBDTYPE _IOR('K', 2, int) /* get keyboard type */
+-#define KB_VANILLAKB 0
+-
+-#define KDSETLEDS _IOW('K', 5, int) /* set keyboard leds */
+-
+-
+-/* End of Mach code. */
+-
+ static enum scancode
+ gnumach_v1_input_next ()
+ {
+@@ -658,6 +583,13 @@ gnumach_v1_input_next ()
+ terminate. */
+ if (err)
+ return 0;
++
++ if (kbd_repeater_opened && data_buf.type == KEYBD_EVENT)
++ {
++ repeat_key (&data_buf);
++ data_buf.type = 0;
++ continue;
++ }
+ }
+ while (data_buf.type != KEYBD_EVENT);
+
+@@ -1088,10 +1020,56 @@ input_loop (any_t unused)
+
+
+
++
++
++static const char doc[] = "PC Keyboard Driver";
++
++static const struct argp_option options[] =
++ {
++ {"repeat", 'r', "NODE", 0, "Set a repeater translator on NODE"},
++ { 0 }
++ };
++
++static error_t
++parse_opt (int key, char *arg, struct argp_state *state)
++{
++ int *pos = (int *) state->input;
++
++ switch (key)
++ {
++ case 'r':
++ repeater_node = arg;
++ break;
++
++ case ARGP_KEY_END:
++ break;
++
++ default:
++ return ARGP_ERR_UNKNOWN;
++ }
++
++ *pos = state->next;
++ return 0;
++}
++
++static struct argp argp = {options, parse_opt, 0, doc};
++
+ /* Initialize the PC keyboard driver. */
+ static error_t
+ pc_kbd_init (void **handle, int no_exit, int argc, char *argv[], int *next)
+ {
++ error_t err;
++ int pos = 1;
++
++ /* Parse the arguments. */
++ err = argp_parse (&argp, argc, argv, ARGP_IN_ORDER | ARGP_NO_EXIT
++ | ARGP_SILENT, 0 , &pos);
++ *next += pos - 1;
++
++ if (err && err != EINVAL)
++ return err;
++
++
+ return 0;
+ }
+
+@@ -1156,6 +1134,10 @@ pc_kbd_start (void *handle)
+ iconv_close (cd);
+ return err;
+ }
++
++ if (repeater_node)
++ setrepeater (repeater_node);
++
+ cthread_detach (cthread_fork (input_loop, NULL));
+
+ return 0;
diff --git a/debian/patches/exec.patch b/debian/patches/exec.patch
new file mode 100644
index 00000000..9155e288
--- /dev/null
+++ b/debian/patches/exec.patch
@@ -0,0 +1,14 @@
+--- hurd-20040301.orig/exec/exec.c
++++ hurd-20040301/exec/exec.c
+@@ -39,6 +39,11 @@
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <unistd.h>
++#include <elf.h>
++
++#ifndef PT_GNU_STACK
++#define PT_GNU_STACK 0x6474e551
++#endif
+
+ mach_port_t procserver; /* Our proc port. */
+
diff --git a/debian/patches/mouse.patch b/debian/patches/mouse.patch
new file mode 100644
index 00000000..76e73500
--- /dev/null
+++ b/debian/patches/mouse.patch
@@ -0,0 +1,485 @@
+--- hurd-20040301.orig/hurd/subsystems
++++ hurd-20040301/hurd/subsystems
+@@ -37,6 +37,7 @@
+ pfinet 37000 Internet configuration calls
+ password 38000 Password checker
+ <ioctl space> 100000- First subsystem of ioctl class 'f' (lowest class)
++kdioctl 120000 Ioctl class 'k' (kd)
+ tioctl 156000 Ioctl class 't' (terminals)
+ tioctl 156200 (continued)
+ <ioctl space> 164200 Last subsystem of ioctl class 'v' (highest class)
+--- hurd-20040301.orig/hurd/kdioctl.defs
++++ hurd-20040301/hurd/kdioctl.defs
+@@ -0,0 +1,39 @@
++/* Definitions for kd ioctls
++ Copyright (C) 1991, 1993, 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
++
++This file is part of the GNU Hurd.
++
++The GNU Hurd is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to
++the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
++
++#include <hurd/hurd_types.defs>
++
++/* Ioctl class `k'; the subsystem is derived from calculations in
++ <ioctls.h>. */
++subsystem kdioctl 120000;
++
++import <hurd/ioctl_types.h>;
++
++skip; /* 0 unused */
++
++/* 1 KDSKBDMODE */
++routine kdioctl_kdskbdmode (
++ port: io_t;
++ in mode: int);
++/* 2 KDGKBDMODE */
++routine kdioctl_kdgkbdmode (
++ port: io_t;
++ out mode: int);
++
++/* 3 - 256 unused */
+--- hurd-20040301.orig/trans/kd.h
++++ hurd-20040301/trans/kd.h
+@@ -0,0 +1,72 @@
++
++/*
++ * Format definitions for 'ioctl' commands in device definitions.
++ *
++ * From BSD4.4.
++ */
++/*
++ * 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.
++ */
++#define MACH_IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
++#define MACH_IOC_VOID 0x20000000 /* no parameters */
++#define MACH_IOC_OUT 0x40000000 /* copy out parameters */
++#define MACH_IOC_IN 0x80000000U /* copy in parameters */
++#define MACH_IOC_INOUT (MACH_IOC_IN|MACH_IOC_OUT)
++
++#define _MACH_IOC(inout,group,num,len) \
++ (inout | ((len & MACH_IOCPARM_MASK) << 16) | ((group) << 8) | (num))
++#define _MACH_IO(g,n) _MACH_IOC(MACH_IOC_VOID, (g), (n), 0)
++#define _MACH_IOR(g,n,t) _MACH_IOC(MACH_IOC_OUT, (g), (n), sizeof(t))
++#define _MACH_IOW(g,n,t) _MACH_IOC(MACH_IOC_IN, (g), (n), sizeof(t))
++#define _MACH_IOWR(g,n,t) _MACH_IOC(MACH_IOC_INOUT, (g), (n), sizeof(t))
++
++/* taken from gnumach-1.1.3/i386/i386at/kd.h */
++
++#define KDSKBDMODE _MACH_IOW('K', 1, int) /* set keyboard mode */
++#define KB_EVENT 1
++#define KB_ASCII 2
++
++#define KDGKBDTYPE _MACH_IOR('K', 2, int) /* get keyboard type */
++
++typedef unsigned short kev_type; /* kd event type */
++typedef unsigned char Scancode;
++/* (used for event records) */
++struct mouse_motion {
++ short mm_deltaX; /* units? */
++ short mm_deltaY;
++};
++
++typedef struct {
++ kev_type type; /* see below */
++ struct timeval time; /* timestamp */
++ union { /* value associated with event */
++ boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */
++ Scancode sc; /* KEYBD_EVENT */
++ struct mouse_motion mmotion; /* MOUSE_MOTION */
++ } value;
++} kd_event;
++
++
++/*
++ * kd_event ID's.
++ */
++#define MOUSE_LEFT 1 /* mouse left button up/down */
++#define MOUSE_MIDDLE 2
++#define MOUSE_RIGHT 3
++#define MOUSE_MOTION 4 /* mouse motion */
++#define KEYBD_EVENT 5 /* key up/down */
++
++/*
++ * Low 3 bits of minor are the com port #.
++ * The high 5 bits of minor are the mouse type
++ */
++#define MOUSE_SYSTEM_MOUSE 0
++#define MICROSOFT_MOUSE 1
++#define IBM_MOUSE 2
++#define NO_MOUSE 3
++#define LOGITECH_TRACKMAN 4
++#define MICROSOFT_MOUSE7 5
++
++
+--- hurd-20040301.orig/trans/Makefile
++++ hurd-20040301/trans/Makefile
+@@ -19,13 +19,15 @@
+ makemode := servers
+
+ targets = symlink firmlink ifsock magic null fifo new-fifo fwd crash \
+- password hello hello-mt streamio fakeroot proxy-defpager
++ password hello hello-mt streamio fakeroot proxy-defpager \
++ mouse
+ SRCS = ifsock.c symlink.c magic.c null.c fifo.c new-fifo.c fwd.c \
+ crash.c firmlink.c password.c hello.c hello-mt.c streamio.c \
+- fakeroot.c proxy-defpager.c
++ fakeroot.c proxy-defpager.c mouse.c
+ OBJS = $(SRCS:.c=.o) fsysServer.o ifsockServer.o passwordServer.o \
+ crashServer.o crash_replyUser.o msgServer.o \
+ default_pagerServer.o default_pagerUser.o \
++ kdioctlServer.o \
+ device_replyServer.o elfcore.o
+ HURDLIBS = threads ports trivfs fshelp pipe ihash shouldbeinlibc
+ password-LDLIBS = $(LIBCRYPT)
+@@ -40,6 +42,7 @@
+
+ symlink: fsysServer.o
+ ifsock: ifsockServer.o
++kbd: kdioctlServer.o
+ crash: crashServer.o crash_replyUser.o msgServer.o elfcore.o
+ password: passwordServer.o
+ streamio: device_replyServer.o
+@@ -48,7 +51,7 @@
+ proxy-defpager crash password streamio: ../libthreads/libthreads.a ../libports/libports.a ../libtrivfs/libtrivfs.a ../libthreads/libthreads.a ../libfshelp/libfshelp.a
+ fifo new-fifo: ../libpipe/libpipe.a
+ fwd: ../libfshelp/libfshelp.a ../libports/libports.a
+-hello-mt magic null ifsock fifo new-fifo firmlink: ../libtrivfs/libtrivfs.a ../libfshelp/libfshelp.a ../libthreads/libthreads.a ../libports/libports.a ../libihash/libihash.a
++mouse hello-mt magic null ifsock fifo new-fifo firmlink: ../libtrivfs/libtrivfs.a ../libfshelp/libfshelp.a ../libthreads/libthreads.a ../libports/libports.a ../libihash/libihash.a
+ hello: ../libtrivfs/libtrivfs.a ../libfshelp/libfshelp.a ../libports/libports.a ../libihash/libihash.a
+ fakeroot: ../libnetfs/libnetfs.a ../libfshelp/libfshelp.a ../libiohelp/libiohelp.a ../libthreads/libthreads.a ../libports/libports.a ../libihash/libihash.a
+ $(targets): ../libshouldbeinlibc/libshouldbeinlibc.a
+--- hurd-20040301.orig/trans/mouse.c
++++ hurd-20040301/trans/mouse.c
+@@ -0,0 +1,318 @@
++/* A translator for mouse.
++
++ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
++
++ Written by UCHIYAMA Yasushi <uch@nop.or.jp>
++
++ 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
++
++#include <hurd.h>
++#include <hurd/ports.h>
++#include <hurd/trivfs.h>
++#include <hurd/fsys.h>
++#include <version.h>
++
++#include <stdio.h>
++#include <unistd.h>
++#include <error.h>
++#include <string.h>
++#include <fcntl.h>
++#include <limits.h>
++#include <argp.h>
++
++const char *argp_program_version = STANDARD_HURD_VERSION (mouse);
++
++#include <device/device.h>
++#include "kd.h"
++
++static char *arg_mouse_protocol,*arg_mouse_device;
++static char mouse_device_name[16];
++
++#define MOUSE_BUF_SIZE 64
++static struct mouse_buffer
++{
++ mach_port_t port;
++ struct mutex lock;
++ struct condition fill;
++ struct condition notfull;
++ kd_event buf[MOUSE_BUF_SIZE];
++ int cnt;
++ int in;
++ int out;
++} mouse;
++
++/* mouse options. Used for startup */
++static const struct argp_option options[] =
++{
++ {"protocol", 'p' ,"PROTOCOL", 0, "mouse PROTOCOL(ps/2,microsoft etc..."},
++ {"device", 'd' ,"DEVICE" , 0, "mouse DEVICE (com0,com1,none)"},
++ {0,0}
++};
++
++static error_t
++parse_opt (int key, char *arg, struct argp_state *state)
++{
++ switch (key)
++ {
++ case 'p': arg_mouse_protocol = arg ; break;
++ case 'd': arg_mouse_device = arg ; break;
++ default:
++ return ARGP_ERR_UNKNOWN;
++ }
++ return 0;
++}
++
++static int
++set_mouse_device_name()
++{
++ /* See gnumach/i386/i386at/kd_mouse.c */
++ struct {
++ int type;
++ char *name;
++ } mouse_tab[] = {
++ { MOUSE_SYSTEM_MOUSE, "mousesystem"},
++ { MICROSOFT_MOUSE, "microsoft" },
++ { IBM_MOUSE, "ps/2" },
++ { NO_MOUSE, "nomouse" },
++ { LOGITECH_TRACKMAN, "logitech" },
++ { MICROSOFT_MOUSE7, "mouse7" },
++ };
++ int i,n = sizeof mouse_tab / sizeof (mouse_tab[0]);
++ for (i = 0; i < n; i++)
++ if (!strcmp (mouse_tab[i].name, arg_mouse_protocol))
++ {
++ int type, unit, device_minor;
++ type = mouse_tab[i].type;
++ if (arg_mouse_device && !strcmp (arg_mouse_device, "com1"))
++ unit = 1;
++ else
++ unit = 0;
++ device_minor = 0;
++ device_minor |= (type<<3);
++ device_minor |= unit;
++ device_minor = device_minor % 100;
++
++ sprintf (mouse_device_name, "mouse%d", device_minor);
++ return 1;
++ }
++ return 0;
++}
++
++int
++main (int argc, char **argv)
++{
++ error_t err;
++ mach_port_t bootstrap;
++ struct trivfs_control *fsys;
++
++ const struct argp argp = { options , parse_opt };
++
++ if(argp_parse (&argp, argc, argv, 0, 0, 0) )
++ error(1, 0, "argp_parse failed.");
++
++ set_mouse_device_name();
++
++ task_get_bootstrap_port (mach_task_self (), &bootstrap);
++ if (bootstrap == MACH_PORT_NULL)
++ error(1, 0, "Must be started as a translator");
++
++ /* Reply to our parent */
++ err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
++ if (err)
++ error(3, err, "Contacting parent");
++ /* Launch. */
++ mutex_init (&mouse.lock);
++ ports_manage_port_operations_multithread (fsys->pi.bucket,trivfs_demuxer, 2 * 60 * 1000, 0, 0);
++
++ exit(0);
++}
++
++static any_t
++mouse_thread (any_t arg)
++{
++ for(;;)
++ {
++ kd_event *event;
++ vm_offset_t buf;
++ mach_msg_type_number_t buf_size;
++ int ncopy;
++ kern_return_t err;
++
++ err = device_read (mouse.port, 0, 0, sizeof (kd_event), (char **)&buf, &buf_size);
++ if (err)
++ return err;
++
++ mutex_lock (&mouse.lock);
++ while (mouse.cnt == MOUSE_BUF_SIZE)
++ condition_wait (&mouse.notfull, &mouse.lock);
++ ncopy = buf_size / sizeof (kd_event);
++ if (MOUSE_BUF_SIZE - mouse.cnt < ncopy )
++ ncopy = MOUSE_BUF_SIZE - mouse.cnt;
++ event = (kd_event*)buf;
++ while (ncopy--)
++ {
++ mouse.buf[mouse.in] = *event++;
++ mouse.in = (mouse.in + 1) % MOUSE_BUF_SIZE;
++ mouse.cnt++;
++ }
++ vm_deallocate (mach_task_self(), buf, buf_size);
++ condition_broadcast (&mouse.fill);
++ mutex_unlock (&mouse.lock);
++ }
++}
++
++static error_t
++open_hook (struct trivfs_peropen *po)
++{
++ kern_return_t err = 0;
++ mach_port_t master;
++ mutex_lock (&mouse.lock);
++ if (po->openmodes & O_READ)
++ {
++ if( mouse.port )
++ return EBUSY;
++ err = get_privileged_ports( NULL, &master );
++ if( err )
++ return err;
++ err = device_open (master, D_READ, mouse_device_name, &mouse.port);
++ mach_port_deallocate (mach_task_self(), master);
++ }
++ mouse.cnt = 0;
++ cthread_detach (cthread_fork (mouse_thread, 0));
++ mutex_unlock (&mouse.lock);
++ return err;
++}
++
++static void
++close_hook (struct trivfs_peropen *po)
++{
++ device_close (mouse.port);
++ mouse.port = (mach_port_t)NULL;
++}
++
++/* Trivfs hooks */
++
++error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) = open_hook;
++void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook;
++
++int trivfs_fstype = FSTYPE_DEV;
++int trivfs_fsid = 0;
++
++int trivfs_support_read = 1;
++int trivfs_support_write = 0;
++int trivfs_support_exec = 0;
++
++int trivfs_allow_open = O_READ | O_WRITE;
++
++void
++trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
++{
++ st->st_blksize = vm_page_size * 256; /* Make transfers LARRRRRGE */
++
++ st->st_size = 0;
++ st->st_blocks = 0;
++
++ st->st_mode &= ~S_IFMT;
++ st->st_mode |= S_IFCHR;
++}
++
++error_t
++trivfs_goaway (struct trivfs_control *fsys, int flags)
++{
++ exit (0);
++}
++
++/* Read data from an IO object. If offset if -1, read from the object
++ maintained file pointer. If the object is not seekable, offset is
++ ignored. The amount desired to be read is in AMT. */
++kern_return_t
++trivfs_S_io_read(struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t replytype,
++ data_t *data,
++ mach_msg_type_number_t *datalen,
++ loff_t offs,
++ vm_size_t amt)
++{
++ int i,n;
++ if (!cred)
++ return EOPNOTSUPP;
++ else if (!(cred->po->openmodes & O_READ))
++ return EBADF;
++
++ mutex_lock (&mouse.lock);
++ while (!mouse.cnt)
++ {
++ if (cred->po->openmodes & O_NONBLOCK)
++ {
++ mutex_unlock (&mouse.lock);
++ return EWOULDBLOCK;
++ }
++ if (hurd_condition_wait (&mouse.fill, &mouse.lock))
++ {
++ mutex_unlock (&mouse.lock);
++ return EINTR;
++ }
++ }
++ if ((n = amt / sizeof (kd_event)) > mouse.cnt)
++ n = mouse.cnt;
++ for (i = 0; i < n; i++)
++ {
++ (*(kd_event **)data)[i] = mouse.buf[mouse.out];
++ mouse.out = (mouse.out + 1 ) % MOUSE_BUF_SIZE;
++ mouse.cnt--;
++ }
++ *datalen = n * sizeof (kd_event);
++ if (n)
++ condition_signal (&mouse.notfull);
++ mutex_unlock (&mouse.lock);
++ return 0;
++}
++
++
++/* SELECT_TYPE is the bitwise OR of SELECT_READ, SELECT_WRITE, and SELECT_URG.
++ Block until one of the indicated types of i/o can be done "quickly", and
++ return the types that are then available. ID_TAG is returned as passed; it
++ is just for the convenience of the user in matching up reply messages with
++ specific requests sent. */
++
++kern_return_t
++trivfs_S_io_select (struct trivfs_protid *cred,
++ mach_port_t reply, mach_msg_type_name_t replytype,
++ int *type)
++{
++ if (!cred)
++ return EOPNOTSUPP;
++ if(*type & ~SELECT_READ )
++ return EINVAL;
++
++ mutex_lock (&mouse.lock);
++ while (1)
++ {
++ if (mouse.cnt)
++ {
++ *type = SELECT_READ;
++ mutex_unlock (&mouse.lock);
++ return 0;
++ }
++ ports_interrupt_self_on_port_death (cred, reply);
++ if (hurd_condition_wait (&mouse.fill, &mouse.lock))
++ {
++ *type = 0;
++ mutex_unlock (&mouse.lock);
++ return EINTR;
++ }
++ }
++}
++
diff --git a/debian/patches/no-debian-dir.patch b/debian/patches/no-debian-dir.patch
new file mode 100644
index 00000000..7a342bbe
--- /dev/null
+++ b/debian/patches/no-debian-dir.patch
@@ -0,0 +1,11 @@
+--- Makefile.bak 2004-05-09 17:03:38.000000000 -0400
++++ Makefile 2004-05-09 17:04:22.000000000 -0400
+@@ -43,7 +43,7 @@
+ benchmarks fstests
+
+ # Other directories
+-other-subdirs = hurd doc config release include debian
++other-subdirs = hurd doc config release include
+
+ # All the subdirectories together
+ subdirs = $(lib-subdirs) $(prog-subdirs) $(other-subdirs)
diff --git a/debian/patches/ttys.patch b/debian/patches/ttys.patch
new file mode 100644
index 00000000..87e29519
--- /dev/null
+++ b/debian/patches/ttys.patch
@@ -0,0 +1,13 @@
+--- hurd-20040301.orig/config/ttys
++++ hurd-20040301/config/ttys
+@@ -5,4 +5,10 @@
+ # name program type status comments
+
+ console "/libexec/getty 9600" mach-color on secure trusted console
++tty1 "/libexec/getty 38400" hurd on secure trusted console
++tty2 "/libexec/getty 38400" hurd on secure trusted console
++tty3 "/libexec/getty 38400" hurd on secure trusted console
++tty4 "/libexec/getty 38400" hurd on secure trusted console
++tty5 "/libexec/getty 38400" hurd on secure trusted console
++tty6 "/libexec/getty 38400" hurd on secure trusted console
+ #com0 "/libexec/getty 9600" dialup on secure
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 00000000..608d7744
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,34 @@
+#!/usr/bin/make -f
+# -*- mode: makefile; coding: utf-8 -*-
+# Copyright © 2003 Jeff Bailey <jbailey@debian.org>
+#
+# 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, 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.
+
+DEB_TAR_SRCDIR := hurd
+DEB_BUILDDIR = $(DEB_SRCDIR)/build
+
+include /usr/share/cdbs/1/rules/tarball.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+
+DEB_CONFIGURE_LIBEXECDIR ="\$${prefix}/libexec"
+DEB_CONFIGURE_USER_FLAGS := --disable-profile
+DEB_MAKE_INSTALL_TARGET = install prefix=$(DEB_DESTDIR) sysconfdir=$(DEB_DESTDIR)/etc localstatedir=$(DEB_DESTDIR)/var
+
+install/hurd::
+ # runsystem is managed by update-alternatives
+ mv debian/tmp/libexec/runsystem debian/tmp/libexec/runsystem.gnu