commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 01/01: New upstream snapshot


From: Samuel Thibault
Subject: [hurd] 01/01: New upstream snapshot
Date: Tue, 14 Jan 2014 02:00:06 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream-merged
in repository hurd.

commit 92aeca9bede721d3b5cd1ab1f49ed7f4f1fe98b1
Author: Samuel Thibault <address@hidden>
Date:   Mon Jan 13 22:52:01 2014 +0000

    New upstream snapshot
---
 auth/auth.c                                   |  20 +-
 benchmarks/Makefile                           |   1 -
 console-client/current-vcs.c                  |   1 -
 console-client/timer.c                        |   1 -
 console-client/trans.c                        |   2 -
 console-client/unicode.h                      |   1 -
 console-client/xkb/xkb-data/types/hurd        |   1 -
 console/mutations.h                           |   1 -
 console/pager.c                               |   1 -
 defpager/Makefile                             |   1 -
 defpager/backing.c                            |   1 -
 doc/navigating                                |   3 +-
 exec/main.c                                   |  21 +-
 ext2fs/dir.c                                  |   2 +
 fatfs/dir.c                                   |   4 +
 fatfs/fatfs.h                                 |   1 -
 fatfs/virt-inode.c                            |   6 -
 fstests/Makefile                              |   1 -
 fstests/opendisk.c                            |   2 -
 hurd/fsys.defs                                |   1 -
 hurd/gensym.awk                               |   1 -
 hurd/ifsock.defs                              |   1 -
 hurd/interrupt.defs                           |   1 -
 hurd/shared.h                                 |   1 -
 hurd/startup.defs                             |   1 -
 hurd/startup_notify.defs                      |   2 -
 hurd/term.defs                                |   1 -
 init/init.c                                   |   7 +-
 isofs/EXTENSIONS                              |   1 -
 isofs/ext.c                                   |   2 -
 libcons/demuxer.c                             |   1 -
 libcons/init-loop.c                           |   1 -
 libcons/mutations.h                           |   1 -
 libcons/vcons-scrollback.c                    |   1 -
 libdirmgt/dirmgt.h                            |   2 -
 libdiskfs/conch-fetch.c                       |   1 -
 libdiskfs/demuxer.c                           |  45 ++--
 libdiskfs/dir-lookup.c                        |  41 +++-
 libdiskfs/dir-renamed.c                       |   2 +-
 libdiskfs/disk-pager.c                        |   3 +-
 libdiskfs/file-lock.c                         |   2 -
 libdiskfs/file-set-trans.c                    |  18 +-
 libdiskfs/fsys-goaway.c                       |   1 -
 libdiskfs/fsys-startup.c                      |   1 -
 libdiskfs/fsys-syncfs.c                       |   1 -
 libdiskfs/ifsock.c                            |   1 -
 libdiskfs/io-async.c                          |   1 -
 libdiskfs/io-map.c                            |   1 -
 libdiskfs/io-modes-get.c                      |   1 -
 libdiskfs/io-stubs.c                          |   1 -
 libdiskfs/io-write.c                          |   1 -
 libdiskfs/node-drop.c                         |   2 -
 libdiskfs/protid-make.c                       |   2 -
 libdiskfs/protid-rele.c                       |   2 -
 libfshelp/fshelp.h                            |  18 +-
 libfshelp/get-identity.c                      |  66 +++---
 libfshelp/lock-acquire.c                      |   3 -
 libfshelp/set-active.c                        |   1 -
 libfshelp/start-translator-long.c             |  11 +-
 libfshelp/transbox-init.c                     |   1 -
 libfshelp/translator-list.c                   |  43 +++-
 libftpconn/names.c                            |   1 -
 libihash/ihash.c                              |   7 +-
 libiohelp/handle_io_release_conch.c           |   1 -
 libiohelp/initialize_conch.c                  |   1 -
 libiohelp/iouser-free.c                       |   2 -
 libnetfs/demuxer.c                            |  34 +--
 libnetfs/dir-link.c                           |   2 -
 libnetfs/dir-lookup.c                         |  43 +++-
 libnetfs/dir-mkfile.c                         |   1 -
 libnetfs/dir-rename.c                         |   1 -
 libnetfs/drop-node.c                          |   2 -
 libnetfs/file-chauthor.c                      |   1 -
 libnetfs/file-getlinknode.c                   |   2 -
 libnetfs/file-set-size.c                      |   1 -
 libnetfs/file-set-translator.c                |  19 +-
 libnetfs/init-loop.c                          |   1 -
 libnetfs/io-get-icky-async-id.c               |   1 -
 libnetfs/io-seek.c                            |   1 -
 libnetfs/io-stat.c                            |   1 -
 libnetfs/io-write.c                           |   2 -
 libnetfs/make-peropen.c                       |   1 -
 libnetfs/modes.h                              |   1 -
 libnetfs/mutations.h                          |   1 -
 libnetfs/nput.c                               |   1 -
 libpager/Makefile                             |   1 -
 libpager/chg-compl.c                          |   2 -
 libpager/no-senders.c                         |   2 -
 libpager/offer-page.c                         |   1 -
 libpager/pager-create.c                       |   2 -
 libpager/pager-flush.c                        |   1 -
 libpager/pager-return.c                       |   1 -
 libpager/pager-shutdown.c                     |   1 -
 libpager/pager-sync.c                         |   1 -
 libpipe/Makefile                              |   1 -
 libports/begin-rpc.c                          |   2 -
 libports/claim-right.c                        |   1 -
 libports/complete-deallocate.c                |   1 -
 libports/count-class.c                        |   3 -
 libports/create-internal.c                    |   1 -
 libports/create-port-noinstall.c              |   3 -
 libports/create-port.c                        |   3 -
 libports/interrupt-notified-rpcs.c            |   1 -
 libports/lookup-port.c                        |   2 -
 libports/manage-multithread.c                 | 106 ++++------
 libports/port-deref-weak.c                    |   1 -
 libports/port-deref.c                         |   2 -
 libports/port-ref.c                           |   2 -
 libports/reallocate-from-external.c           |   3 +-
 libports/reallocate-port.c                    |   8 +-
 libports/resume-all-rpcs.c                    |   2 -
 libports/resume-class-rpcs.c                  |   1 -
 libports/resume-port-rpcs.c                   |   3 -
 libports/transfer-right.c                     |   6 +-
 libps/procstat.c                              |   7 +
 libps/spec.c                                  |   2 +-
 libshouldbeinlibc/cacheq.c                    |   2 +-
 libshouldbeinlibc/canon-host.c                |   1 -
 libshouldbeinlibc/fsysops.c                   |   1 +
 libshouldbeinlibc/idvec-auth.c                |   1 +
 libshouldbeinlibc/idvec.c                     |   3 +-
 libshouldbeinlibc/idvec.h                     |   1 -
 libshouldbeinlibc/localhost.c                 |   2 +-
 libshouldbeinlibc/maptime.c                   |  19 +-
 libshouldbeinlibc/nullauth.c                  |   2 -
 libshouldbeinlibc/portxlate.c                 |   8 +-
 libshouldbeinlibc/shared-dom.c                |   3 -
 libshouldbeinlibc/timefmt.c                   |   4 +-
 libshouldbeinlibc/ugids-argp.c                |   3 +-
 libshouldbeinlibc/ugids-auth.c                |   2 +-
 libshouldbeinlibc/ugids-imply.c               |   3 +-
 libshouldbeinlibc/ugids-merge.c               |   3 +-
 libshouldbeinlibc/ugids-subtract.c            |   4 +-
 libshouldbeinlibc/ugids-verify-auth.c         |   7 +-
 libshouldbeinlibc/ugids-verify.c              |   7 +-
 libshouldbeinlibc/ugids.c                     |   1 +
 libshouldbeinlibc/ugids.h                     |   2 +
 libshouldbeinlibc/wire.c                      |   2 +-
 libshouldbeinlibc/wire.h                      |   1 -
 libthreads/Makefile.GNU                       |   1 -
 libthreads/Makefile.GNU2                      |   1 -
 libthreads/alpha/lock.S                       |   1 -
 libtreefs/Makefile                            |   1 -
 libtreefs/s-fsys.c                            |   1 -
 libtrivfs/demuxer.c                           |  32 +--
 libtrivfs/protid-clean.c                      |   3 -
 libtrivfs/times.c                             |   4 -
 mach-defpager/Makefile                        |   3 -
 mach-defpager/default_pager.c                 | 236 ++++++++++-----------
 mach-defpager/kalloc.c                        |  10 +-
 mach-defpager/queue.h                         |  10 +-
 mach-defpager/wiring.c                        |   2 +-
 nfs/cache.c                                   |   1 -
 nfs/main.c                                    |   1 -
 nfsd/Makefile                                 |   1 -
 nfsd/ops.c                                    |   2 +-
 nfsd/xdr.c                                    |   2 +-
 pfinet/dummy.c                                |   4 -
 pfinet/glue-include/linux/interrupt.h         |   2 +
 pfinet/linux-src/arch/i386/lib/checksum.S     |   2 +-
 pfinet/linux-src/arch/i386/lib/old-checksum.c |   2 -
 pfinet/linux-src/arch/s390/lib/checksum.c     |   1 -
 pfinet/linux-src/arch/sparc64/lib/checksum.S  |   1 -
 pfinet/linux-src/include/asm-s390/checksum.h  |   2 -
 pfinet/linux-src/include/linux/busmouse.h     |   1 -
 pfinet/linux-src/include/linux/coda.h         |   3 +-
 pfinet/linux-src/include/linux/digiPCI.h      |   5 -
 pfinet/linux-src/include/linux/dmascc.h       |   1 -
 pfinet/linux-src/include/linux/efs_dir.h      |   1 -
 pfinet/linux-src/include/linux/efs_fs.h       |   1 -
 pfinet/linux-src/include/linux/efs_fs_i.h     |   1 -
 pfinet/linux-src/include/linux/efs_fs_sb.h    |   1 -
 pfinet/linux-src/include/linux/efs_vh.h       |   1 -
 pfinet/linux-src/include/linux/epca.h         |   1 -
 pfinet/linux-src/include/linux/hayesesp.h     |   1 -
 pfinet/linux-src/include/linux/ioctl.h        |   1 -
 pfinet/linux-src/include/linux/ipc.h          |   2 -
 pfinet/linux-src/include/linux/irda.h         |   4 -
 pfinet/linux-src/include/linux/isicom.h       |   1 -
 pfinet/linux-src/include/linux/kmod.h         |   1 -
 pfinet/linux-src/include/linux/locks.h        |   1 -
 pfinet/linux-src/include/linux/lp_intern.h    |   1 -
 pfinet/linux-src/include/linux/lp_mfc.h       |   1 -
 pfinet/linux-src/include/linux/ncp_fs_sb.h    |   1 -
 pfinet/linux-src/include/linux/ntfs_fs.h      |   1 -
 pfinet/linux-src/include/linux/nubus.h        |   1 -
 pfinet/linux-src/include/linux/route.h        |   1 -
 pfinet/linux-src/include/linux/sdla_fr.h      |   1 -
 pfinet/linux-src/include/linux/sdlapci.h      |   1 -
 pfinet/linux-src/include/linux/sdlasfm.h      |   1 -
 pfinet/linux-src/include/linux/serial_reg.h   |   1 -
 pfinet/linux-src/include/linux/sysv_fs.h      |   1 -
 pfinet/linux-src/include/linux/sysv_fs_i.h    |   1 -
 pfinet/linux-src/include/linux/sysv_fs_sb.h   |   1 -
 pfinet/linux-src/include/linux/tpqic02.h      |   1 -
 pfinet/linux-src/include/linux/tty_flip.h     |   7 -
 pfinet/linux-src/include/linux/vmalloc.h      |   1 -
 pfinet/linux-src/include/linux/wanpipe.h      |   1 -
 pfinet/linux-src/include/net/br.h             |   3 -
 pfinet/linux-src/include/net/inet_common.h    |   2 -
 pfinet/linux-src/include/net/ipv6.h           |   3 -
 pfinet/linux-src/include/net/llc.h            |   1 -
 pfinet/linux-src/include/net/llc_name.h       |   1 -
 pfinet/linux-src/include/net/llccall.h        |   1 -
 pfinet/linux-src/include/net/neighbour.h      |   2 -
 pfinet/linux-src/include/net/rarp.h           |   1 -
 pfinet/linux-src/include/net/scm.h            |   1 -
 pfinet/linux-src/net/core/dev_mcast.c         |   1 -
 pfinet/linux-src/net/ipv4/Config.in           |   1 -
 pfinet/linux-src/net/ipv4/fib_frontend.c      |   1 -
 pfinet/linux-src/net/ipv4/igmp.c              |   1 -
 pfinet/linux-src/net/ipv4/ip_input.c          |   1 -
 pfinet/linux-src/net/ipv4/ip_masq_quake.c     |   2 -
 pfinet/linux-src/net/ipv4/ip_output.c         |   1 -
 pfinet/linux-src/net/ipv4/timer.c             |   1 -
 pfinet/linux-src/net/ipv4/utils.c             |   1 -
 pfinet/linux-src/net/ipv6/exthdrs.c           |   1 -
 pfinet/linux-src/net/ipv6/ip6_fib.c           |   2 -
 pfinet/loopback.c                             |   7 +
 pfinet/main.c                                 |  52 +++--
 pfinet/sched.c                                |   7 +-
 pflocal/pflocal.c                             |  14 +-
 pflocal/sserver.c                             |  25 ++-
 proc/host.c                                   |   6 +-
 proc/main.c                                   |  38 ++--
 proc/mgt.c                                    |  27 ++-
 proc/msg.c                                    |   2 +-
 proc/pgrp.c                                   |   8 +-
 proc/proc.h                                   |   9 +-
 proc/proc_exc.defs                            |   3 -
 release/README                                |   2 -
 release/SOURCES.0.2                           |   2 -
 release/dist-README                           |   3 -
 release/menu.lst                              |   1 -
 term/hurdio.c                                 |   7 +-
 trans/fakeroot.c                              | 291 +++++++++++++++++---------
 trans/mtab.c                                  | 176 ++++++++++++----
 usermux/node.c                                |   2 +-
 utils/Makefile                                |   1 +
 utils/fakeauth.c                              |  19 +-
 utils/frobauth.c                              |   4 +-
 utils/mount.c                                 |   7 +-
 utils/portinfo.c                              | 126 ++++++++++-
 utils/rpctrace.c                              | 124 ++++++++---
 utils/settrans.c                              |  91 +++++---
 245 files changed, 1299 insertions(+), 908 deletions(-)

diff --git a/auth/auth.c b/auth/auth.c
index 167d8f0..a395e79 100644
--- a/auth/auth.c
+++ b/auth/auth.c
@@ -381,7 +381,7 @@ S_auth_server_authenticate (struct authhandle *serverauth,
 {
   struct pending_user *u;
   struct authhandle *user;
-  error_t err;
+  error_t err = 0;
 
   if (! serverauth)
     return EOPNOTSUPP;
@@ -468,10 +468,20 @@ S_auth_server_authenticate (struct authhandle *serverauth,
 static int
 auth_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 {
-  extern int auth_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
-  return (auth_server (inp, outp) ||
-         ports_interrupt_server (inp, outp) ||
-         ports_notify_server (inp, outp));
+  mig_routine_t auth_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = auth_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)) ||
+      (routine = ports_interrupt_server_routine (inp)))
+    {
+      (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
 
 
diff --git a/benchmarks/Makefile b/benchmarks/Makefile
index 505aa5b..416315e 100644
--- a/benchmarks/Makefile
+++ b/benchmarks/Makefile
@@ -23,4 +23,3 @@ OBJS = forks.o
 target = forks
 
 include ../Makeconf
-
diff --git a/console-client/current-vcs.c b/console-client/current-vcs.c
index 1b63e0b..e88e549 100644
--- a/console-client/current-vcs.c
+++ b/console-client/current-vcs.c
@@ -220,4 +220,3 @@ struct driver_ops driver_current_vcs_ops =
     current_vcs_start,
     current_vcs_fini
   };
-
diff --git a/console-client/timer.c b/console-client/timer.c
index a8869b5..69cc643 100644
--- a/console-client/timer.c
+++ b/console-client/timer.c
@@ -217,4 +217,3 @@ timer_change (struct timer_list *timer, long long expires)
   timer->expires = expires;
   timer_add (timer);
 }
-
diff --git a/console-client/trans.c b/console-client/trans.c
index 8219f97..00c5407 100644
--- a/console-client/trans.c
+++ b/console-client/trans.c
@@ -482,7 +482,6 @@ netfs_attempt_mkfile (struct iouser *user, struct node *dir,
 
   *np = netfs_make_node (nn);
   pthread_mutex_lock (&(*np)->lock);
-  pthread_spin_unlock (&netfs_node_refcnt_lock);
 
   return 0;
 }
@@ -624,7 +623,6 @@ void netfs_node_norefs (struct node *np)
   if (np->nn->symlink_path)
     free (np->nn->symlink_path);
 
-  pthread_spin_unlock (&netfs_node_refcnt_lock);
   free (np->nn);
   free (np);
 }
diff --git a/console-client/unicode.h b/console-client/unicode.h
index 386628c..a399174 100644
--- a/console-client/unicode.h
+++ b/console-client/unicode.h
@@ -347,4 +347,3 @@
 #define UNICODE_REPLACEMENT_CHARACTER                       ((wchar_t) 0xfffd)
 
 #endif /* _UNICODE_H_ */
-
diff --git a/console-client/xkb/xkb-data/types/hurd 
b/console-client/xkb/xkb-data/types/hurd
index e6c7aa0..11ad564 100644
--- a/console-client/xkb/xkb-data/types/hurd
+++ b/console-client/xkb/xkb-data/types/hurd
@@ -15,4 +15,3 @@ default xkb_types "hurd" {
       level_name[Level4] = "Hurd console3";
     };
 };
-
diff --git a/console/mutations.h b/console/mutations.h
index a8183fc..5f26672 100644
--- a/console/mutations.h
+++ b/console/mutations.h
@@ -24,4 +24,3 @@
 #define IO_DESTRUCTOR end_using_protid_port (protid_t)
 
 #define TIOCTL_IMPORTS import "priv.h";
-
diff --git a/console/pager.c b/console/pager.c
index 4d0c5cd..87c36f0 100644
--- a/console/pager.c
+++ b/console/pager.c
@@ -237,4 +237,3 @@ user_pager_get_filemap (struct user_pager *user_pager, 
vm_prot_t prot)
 
   return user_pager->memobj;
 }
-
diff --git a/defpager/Makefile b/defpager/Makefile
index 8f92dd7..5b966c4 100644
--- a/defpager/Makefile
+++ b/defpager/Makefile
@@ -31,4 +31,3 @@ comma=,
 LDFLAGS=-Wl,$(subst :,$(comma),$(strip $(subst-functions)))
 
 include ../Makeconf
-
diff --git a/defpager/backing.c b/defpager/backing.c
index 24aab6d..7383c91 100644
--- a/defpager/backing.c
+++ b/defpager/backing.c
@@ -128,4 +128,3 @@ return_backing_pages (off_t *map, int maplen)
     }
   pthread_mutex_unlock (&bmap_lock);
 }
-
diff --git a/doc/navigating b/doc/navigating
index c000c56..b7e34dc 100644
--- a/doc/navigating
+++ b/doc/navigating
@@ -50,5 +50,4 @@ exploring the implementation of various things in the hurd C 
library.
 
 You should take a look at all the libraries in the Hurd; spend time
 reading the code.  Feel free to ask questions to help understand what
-you read.  
-
+you read.
diff --git a/exec/main.c b/exec/main.c
index d23cc12..41b1db4 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1,6 +1,6 @@
 /* GNU Hurd standard exec server, main program and server mechanics.
 
-   Copyright (C) 1992,93,94,95,96,97,98,99,2000,01,02
+   Copyright (C) 1992,93,94,95,96,97,98,99,2000,01,02,13
        Free Software Foundation, Inc.
    Written by Roland McGrath.
    This file is part of the GNU Hurd.
@@ -49,11 +49,20 @@ char **save_argv;
 static int
 exec_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 {
-  extern int exec_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
-  extern int exec_startup_server (mach_msg_header_t *, mach_msg_header_t *);
-  return (exec_startup_server (inp, outp) ||
-         exec_server (inp, outp) ||
-         trivfs_demuxer (inp, outp));
+  mig_routine_t exec_server_routine (mach_msg_header_t *);
+  mig_routine_t exec_startup_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = exec_server_routine (inp)) ||
+      (routine = NULL, trivfs_demuxer (inp, outp)) ||
+      (routine = exec_startup_server_routine (inp)))
+    {
+      if (routine)
+        (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
 
 
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index c075246..a7eeaaa 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -195,6 +195,8 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum 
lookup_type type,
   err = vm_map (mach_task_self (),
                &buf, buflen, 0, 1, memobj, 0, 0, prot, prot, 0);
   mach_port_deallocate (mach_task_self (), memobj);
+  if (err)
+    return err;
 
   inum = 0;
 
diff --git a/fatfs/dir.c b/fatfs/dir.c
index b2b7d7e..5a38c63 100644
--- a/fatfs/dir.c
+++ b/fatfs/dir.c
@@ -231,6 +231,8 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum 
lookup_type type,
   err = vm_map (mach_task_self (),
                 &buf, buflen, 0, 1, memobj, 0, 0, prot, prot, 0);
   mach_port_deallocate (mach_task_self (), memobj);
+  if (err)
+    return err;
 
   inum = 0;
 
@@ -863,6 +865,8 @@ diskfs_get_directs (struct node *dp,
   err = vm_map (mach_task_self (),
                 &buf, buflen, 0, 1, memobj, 0, 0, prot, prot, 0);
   mach_port_deallocate (mach_task_self (), memobj);
+  if (err)
+    return err;
 
   bufp = buf;
   for (i = 0; i < entry; i ++)
diff --git a/fatfs/fatfs.h b/fatfs/fatfs.h
index 06955a4..9d38546 100644
--- a/fatfs/fatfs.h
+++ b/fatfs/fatfs.h
@@ -125,4 +125,3 @@ void fat_to_unix_filename (const char *, char *);
 error_t diskfs_cached_lookup_in_dirbuf (int cache_id, struct node **npp,
                                        vm_address_t buf);
 void refresh_node_stats (void);
-
diff --git a/fatfs/virt-inode.c b/fatfs/virt-inode.c
index 5d134b0..7138169 100644
--- a/fatfs/virt-inode.c
+++ b/fatfs/virt-inode.c
@@ -227,9 +227,3 @@ vi_key_t vi_free(inode_t v_inode)
   pthread_spin_unlock (&inode_table_lock);
   return key;
 }
-
-
-
-
-
-
diff --git a/fstests/Makefile b/fstests/Makefile
index 961c57a..6374242 100644
--- a/fstests/Makefile
+++ b/fstests/Makefile
@@ -27,4 +27,3 @@ timertest: timertest.o
 fstests: fstests.o
 opendisk: opendisk.o
 fdtests: fdtests.o
-
diff --git a/fstests/opendisk.c b/fstests/opendisk.c
index 75170b7..0e87b14 100644
--- a/fstests/opendisk.c
+++ b/fstests/opendisk.c
@@ -120,5 +120,3 @@ main (int argc, char **argv)
     }
   exit (0);
 }
-
-
diff --git a/hurd/fsys.defs b/hurd/fsys.defs
index c031da7..7f99f7f 100644
--- a/hurd/fsys.defs
+++ b/hurd/fsys.defs
@@ -146,4 +146,3 @@ routine fsys_get_source (
        server: fsys_t;
        RPT
        out source: string_t);
-
diff --git a/hurd/gensym.awk b/hurd/gensym.awk
index 2128321..6c6e1a1 100644
--- a/hurd/gensym.awk
+++ b/hurd/gensym.awk
@@ -75,4 +75,3 @@ BEGIN {
 END {
        print "}"
 }
-
diff --git a/hurd/ifsock.defs b/hurd/ifsock.defs
index dbccc42..c61f895 100644
--- a/hurd/ifsock.defs
+++ b/hurd/ifsock.defs
@@ -32,4 +32,3 @@ routine
 ifsock_getsockaddr (
        file: file_t;
        out sockaddr: mach_port_copy_send_t);
-
diff --git a/hurd/interrupt.defs b/hurd/interrupt.defs
index 6e3cc7d..cc3ad1e 100644
--- a/hurd/interrupt.defs
+++ b/hurd/interrupt.defs
@@ -30,4 +30,3 @@ routine
 interrupt_operation (object: mach_port_t;
                     waittime timeout: natural_t;
                     msgseqno seqno: mach_port_seqno_t);
-
diff --git a/hurd/shared.h b/hurd/shared.h
index 9d46732..6f13637 100644
--- a/hurd/shared.h
+++ b/hurd/shared.h
@@ -156,4 +156,3 @@ struct shared_io
 /* Look at this value to determine the byte order the server is using,
    and then use it.  */
 #define SHARED_PAGE_MAGIC 0xaabbccdd
-
diff --git a/hurd/startup.defs b/hurd/startup.defs
index bd5cd6e..4b14e20 100644
--- a/hurd/startup.defs
+++ b/hurd/startup.defs
@@ -78,4 +78,3 @@ routine startup_authinit (
        sreplyport reply_port: sreply_port_t;
        auth: mach_port_send_t;
        out proc: mach_port_send_t);
-
diff --git a/hurd/startup_notify.defs b/hurd/startup_notify.defs
index 2388f88..50712e9 100644
--- a/hurd/startup_notify.defs
+++ b/hurd/startup_notify.defs
@@ -33,5 +33,3 @@ STARTUP_NOTIFY_IMPORTS
 routine startup_dosync (
        notify_port: mach_port_t;
        waittime timeout: natural_t);
- 
-
diff --git a/hurd/term.defs b/hurd/term.defs
index dbc03b7..17ba4f3 100644
--- a/hurd/term.defs
+++ b/hurd/term.defs
@@ -120,4 +120,3 @@ routine termctty_open_terminal (
 routine term_get_peername (
        terminal: io_t;
        out name: string_t);
-
diff --git a/init/init.c b/init/init.c
index 94f1a9b..b7b40bd 100644
--- a/init/init.c
+++ b/init/init.c
@@ -961,6 +961,7 @@ process_signal (int signo)
              }
 
              launch_something (desc);
+              free (desc);
            }
        }
     }
@@ -1201,6 +1202,10 @@ S_startup_essential_task (mach_port_t server,
   static int authinit, procinit, execinit;
   int fail;
 
+  /* Always deallocate the extra reference this message carries.  */
+  if (MACH_PORT_VALID (credential))
+    mach_port_deallocate (mach_task_self (), credential);
+
   if (credential != host_priv)
     return EPERM;
 
@@ -1208,8 +1213,6 @@ S_startup_essential_task (mach_port_t server,
   if (fail)
     return fail;
 
-  mach_port_deallocate (mach_task_self (), credential);
-
   if (!booted)
     {
       if (!strcmp (name, "auth"))
diff --git a/isofs/EXTENSIONS b/isofs/EXTENSIONS
index 625cdac..8843aa5 100644
--- a/isofs/EXTENSIONS
+++ b/isofs/EXTENSIONS
@@ -13,4 +13,3 @@ MD: A full 32 bit hurd mode; if not present, the mode is the 
one found
 in the PX record.
 
 FL: 32 bits of flags; if not present, the flags are zero.
-
diff --git a/isofs/ext.c b/isofs/ext.c
index 80379b7..5e5f3ed 100644
--- a/isofs/ext.c
+++ b/isofs/ext.c
@@ -56,5 +56,3 @@ struct susp_ext extensions[] =
   { 0, 0, 0, 0, susp_extensions },
   { 0, 0, 0, 0, 0 },
 }
-
-
diff --git a/libcons/demuxer.c b/libcons/demuxer.c
index 8982bfa..2db0890 100644
--- a/libcons/demuxer.c
+++ b/libcons/demuxer.c
@@ -27,4 +27,3 @@ cons_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 
   return (cons_fs_notify_server (inp, outp));
 }
-
diff --git a/libcons/init-loop.c b/libcons/init-loop.c
index 18576cb..987754d 100644
--- a/libcons/init-loop.c
+++ b/libcons/init-loop.c
@@ -29,4 +29,3 @@ cons_server_loop (void)
                                           cons_demuxer, 0);
   /* Not reached.  */
 }
-
diff --git a/libcons/mutations.h b/libcons/mutations.h
index af5ab2d..c895447 100644
--- a/libcons/mutations.h
+++ b/libcons/mutations.h
@@ -24,4 +24,3 @@
 #define FS_NOTIFY_DESTRUCTOR end_using_notify_port (cons_notify_t)
 
 #define FS_NOTIFY_IMPORTS import "priv.h";
-
diff --git a/libcons/vcons-scrollback.c b/libcons/vcons-scrollback.c
index 625fc4b..0cf6b26 100644
--- a/libcons/vcons-scrollback.c
+++ b/libcons/vcons-scrollback.c
@@ -161,4 +161,3 @@ cons_vcons_scrollback (vcons_t vcons, cons_scroll_t type, 
float value)
   pthread_mutex_unlock (&vcons->lock);
   return ret;
 }
-
diff --git a/libdirmgt/dirmgt.h b/libdirmgt/dirmgt.h
index 6b2006b..1592160 100644
--- a/libdirmgt/dirmgt.h
+++ b/libdirmgt/dirmgt.h
@@ -49,5 +49,3 @@ dirmgt_readdir (struct directory *dir, char **data, u_int 
*datacnt,
    with the reported error. */
 error_t
 (*dirmgt_find_entry)(struct directory *dir, char *name);
-
-
diff --git a/libdiskfs/conch-fetch.c b/libdiskfs/conch-fetch.c
index 2c5d0fd..43a0e87 100644
--- a/libdiskfs/conch-fetch.c
+++ b/libdiskfs/conch-fetch.c
@@ -69,4 +69,3 @@ iohelp_fetch_shared_data (void *arg)
   if (diskfs_synchronous && mod)
     diskfs_node_update (cred->po->np, 1);
 }
-
diff --git a/libdiskfs/demuxer.c b/libdiskfs/demuxer.c
index 51234cd..5412f26 100644
--- a/libdiskfs/demuxer.c
+++ b/libdiskfs/demuxer.c
@@ -1,5 +1,5 @@
 /* Demultiplexer for diskfs library
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 2013 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -21,22 +21,29 @@ int
 diskfs_demuxer (mach_msg_header_t *inp,
                mach_msg_header_t *outp)
 {
-  int diskfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
-  int diskfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
-  int diskfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
-  int diskfs_exec_startup_server (mach_msg_header_t *, mach_msg_header_t *);
-  int diskfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *);
-  int diskfs_startup_notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  
-  
-  return (diskfs_io_server (inp, outp)
-         || diskfs_fs_server (inp, outp)
-         || ports_notify_server (inp, outp)
-         || diskfs_fsys_server (inp, outp)
-         || diskfs_exec_startup_server (inp, outp)
-         || ports_interrupt_server (inp, outp)
-         || (diskfs_shortcut_ifsock ? diskfs_ifsock_server (inp, outp) : 0)
-         || diskfs_startup_notify_server (inp, outp));
-}
+  mig_routine_t diskfs_io_server_routine (mach_msg_header_t *);
+  mig_routine_t diskfs_fs_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+  mig_routine_t diskfs_fsys_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+  mig_routine_t diskfs_ifsock_server_routine (mach_msg_header_t *);
+  mig_routine_t diskfs_exec_startup_server_routine (mach_msg_header_t *);
+  mig_routine_t diskfs_startup_notify_server_routine (mach_msg_header_t *);
 
-  
+  mig_routine_t routine;
+  if ((routine = diskfs_io_server_routine (inp)) ||
+      (routine = diskfs_fs_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)) ||
+      (routine = diskfs_fsys_server_routine (inp)) ||
+      (routine = ports_interrupt_server_routine (inp)) ||
+      (diskfs_shortcut_ifsock ?
+       (routine = diskfs_ifsock_server_routine (inp)) : 0) ||
+      (routine = diskfs_startup_notify_server_routine (inp)) ||
+      (routine = diskfs_exec_startup_server_routine (inp)))
+    {
+      (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
+}
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 86116e3..3950bf9 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -1,6 +1,6 @@
 /* libdiskfs implementation of fs.defs:dir_lookup
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-     2002, 2008, 2013 Free Software Foundation, Inc.
+     2002, 2008, 2013, 2014 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -74,6 +74,10 @@ diskfs_S_dir_lookup (struct protid *dircred,
   if (! relpath)
     return ENOMEM;
 
+  /* Keep a pointer to the start of the path for length
+     calculations.  */
+  char *path_start = path;
+
   *returned_port_poly = MACH_MSG_TYPE_MAKE_SEND;
   *retry = FS_RETRY_NORMAL;
   retryname[0] = '\0';
@@ -274,11 +278,16 @@ diskfs_S_dir_lookup (struct protid *dircred,
            goto out;
 
          dirport = ports_get_send_right (newpi);
-         ports_port_deref (newpi);
-         newpi = 0;
          if (np != dnp)
            pthread_mutex_unlock (&dnp->lock);
 
+         /* Check if an active translator is currently running.  If
+            not, fshelp_fetch_root will start one.  In that case, we
+            need to register it in the list of active
+            translators.  */
+         boolean_t register_translator =
+           np->transbox.active == MACH_PORT_NULL;
+
          error = fshelp_fetch_root (&np->transbox, dircred->po,
                                     dirport, dircred->user,
                                     lastcomp ? flags : 0,
@@ -301,9 +310,35 @@ diskfs_S_dir_lookup (struct protid *dircred,
                  *end++ = '/';
                  strcpy (end, nextname);
                }
+
+             if (register_translator)
+               {
+                 char *translator_path = strdupa (relpath);
+                 if (nextname != NULL)
+                   {
+                     /* This was not the last path component.
+                        NEXTNAME points to the next component, locate
+                        the end of the current component and use it
+                        to trim TRANSLATOR_PATH.  */
+                     char *end = nextname;
+                     while (*end != 0)
+                       end--;
+                     translator_path[end - path_start] = '\0';
+                   }
+
+                 error = fshelp_set_active_translator (&newpi->pi,
+                                                       translator_path,
+                                                       np->transbox.active);
+                 if (error)
+                   goto out;
+               }
+
              goto out;
            }
 
+         ports_port_deref (newpi);
+         newpi = NULL;
+
          /* ENOENT means there was a hiccup, and the translator
             vanished while NP was unlocked inside fshelp_fetch_root.
             Reacquire the locks, and continue as normal. */
diff --git a/libdiskfs/dir-renamed.c b/libdiskfs/dir-renamed.c
index d73dc28..9b7ec3a 100644
--- a/libdiskfs/dir-renamed.c
+++ b/libdiskfs/dir-renamed.c
@@ -132,7 +132,7 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, 
const char *fromname,
       if (tdp->dn_stat.st_nlink == diskfs_link_max - 1)
        {
          err = EMLINK;
-         return EMLINK;
+         goto out;
        }
       tdp->dn_stat.st_nlink++;
       tdp->dn_set_ctime = 1;
diff --git a/libdiskfs/disk-pager.c b/libdiskfs/disk-pager.c
index 8fe8f80..9a0d9d8 100644
--- a/libdiskfs/disk-pager.c
+++ b/libdiskfs/disk-pager.c
@@ -71,7 +71,8 @@ diskfs_start_disk_pager (struct user_pager_info *upi,
   diskfs_disk_pager = pager_create (upi, pager_bucket,
                                    may_cache, MEMORY_OBJECT_COPY_NONE,
                                    notify_on_evict);
-  assert (diskfs_disk_pager);
+  if (diskfs_disk_pager == NULL)
+    error (2, errno, "creating diskfs_disk_pager failed");
 
   /* Get a port to the disk pager.  */
   disk_pager_port = pager_get_port (diskfs_disk_pager);
diff --git a/libdiskfs/file-lock.c b/libdiskfs/file-lock.c
index 441daeb..bff1df7 100644
--- a/libdiskfs/file-lock.c
+++ b/libdiskfs/file-lock.c
@@ -34,5 +34,3 @@ diskfs_S_file_lock (struct protid *cred, int flags)
   pthread_mutex_unlock (&cred->po->np->lock);
   return err;
 }
-
-    
diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c
index 8de2e64..58f6255 100644
--- a/libdiskfs/file-set-trans.c
+++ b/libdiskfs/file-set-trans.c
@@ -1,5 +1,5 @@
 /* libdiskfs implementation of fs.defs: file_set_translator
-   Copyright (C) 1992,93,94,95,96,99,2001,02,13
+   Copyright (C) 1992,93,94,95,96,99,2001,02,13,14
      Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
@@ -208,20 +208,8 @@ diskfs_S_file_set_translator (struct protid *cred,
 
   pthread_mutex_unlock (&np->lock);
 
-  if (! error && cred->po->path)
-    error = fshelp_set_active_translator (cred->po->path, active);
-
-  if (! error && active != MACH_PORT_NULL)
-    {
-      mach_port_t old;
-      error = mach_port_request_notification (mach_task_self (), active,
-                                             MACH_NOTIFY_DEAD_NAME, 0,
-                                             cred->pi.port_right,
-                                             MACH_MSG_TYPE_MAKE_SEND_ONCE,
-                                             &old);
-      if (old != MACH_PORT_NULL)
-       mach_port_deallocate (mach_task_self (), old);
-    }
+  if (! error && cred->po->path && active_flags & FS_TRANS_SET)
+    error = fshelp_set_active_translator (&cred->pi, cred->po->path, active);
 
   return error;
 }
diff --git a/libdiskfs/fsys-goaway.c b/libdiskfs/fsys-goaway.c
index 611014f..2aabce8 100644
--- a/libdiskfs/fsys-goaway.c
+++ b/libdiskfs/fsys-goaway.c
@@ -51,4 +51,3 @@ diskfs_S_fsys_goaway (fsys_t controlport,
   ports_port_deref (pt);
   return ret;
 }
-
diff --git a/libdiskfs/fsys-startup.c b/libdiskfs/fsys-startup.c
index baa94ca..f68438e 100644
--- a/libdiskfs/fsys-startup.c
+++ b/libdiskfs/fsys-startup.c
@@ -34,4 +34,3 @@ diskfs_S_fsys_startup (mach_port_t port,
 {
   return diskfs_execboot_fsys_startup (port, flags, ctl, real, realpoly);
 }
-
diff --git a/libdiskfs/fsys-syncfs.c b/libdiskfs/fsys-syncfs.c
index 7d0c484..beb8881 100644
--- a/libdiskfs/fsys-syncfs.c
+++ b/libdiskfs/fsys-syncfs.c
@@ -72,4 +72,3 @@ diskfs_S_fsys_syncfs (fsys_t controlport,
 
   return 0;
 }
-
diff --git a/libdiskfs/ifsock.c b/libdiskfs/ifsock.c
index 01a9b1e..caf6688 100644
--- a/libdiskfs/ifsock.c
+++ b/libdiskfs/ifsock.c
@@ -129,4 +129,3 @@ diskfs_S_ifsock_getsockaddr (struct protid *cred,
   pthread_mutex_unlock (&np->lock);
   return 0;
 }
-      
diff --git a/libdiskfs/io-async.c b/libdiskfs/io-async.c
index e5ed6d9..b619ddd 100644
--- a/libdiskfs/io-async.c
+++ b/libdiskfs/io-async.c
@@ -28,4 +28,3 @@ diskfs_S_io_async (struct protid *cred __attribute__ 
((unused)),
 {
   return EOPNOTSUPP;
 }
-
diff --git a/libdiskfs/io-map.c b/libdiskfs/io-map.c
index 3c1966d..843b6b1 100644
--- a/libdiskfs/io-map.c
+++ b/libdiskfs/io-map.c
@@ -70,4 +70,3 @@ error:
   pthread_mutex_unlock (&node->lock);
   return errno;
 }
-
diff --git a/libdiskfs/io-modes-get.c b/libdiskfs/io-modes-get.c
index 6bed408..9ed3b43 100644
--- a/libdiskfs/io-modes-get.c
+++ b/libdiskfs/io-modes-get.c
@@ -31,4 +31,3 @@ diskfs_S_io_get_openmodes (struct protid *cred,
   pthread_mutex_unlock (&cred->po->np->lock);
   return 0;
 }
-
diff --git a/libdiskfs/io-stubs.c b/libdiskfs/io-stubs.c
index aa1e48b..592b3d8 100644
--- a/libdiskfs/io-stubs.c
+++ b/libdiskfs/io-stubs.c
@@ -60,4 +60,3 @@ diskfs_S_io_readnotify (struct protid *cred)
 {
   return cred ? 0 : EOPNOTSUPP;
 }
-     
diff --git a/libdiskfs/io-write.c b/libdiskfs/io-write.c
index 26e0be4..2967c4c 100644
--- a/libdiskfs/io-write.c
+++ b/libdiskfs/io-write.c
@@ -56,7 +56,6 @@ diskfs_S_io_write (struct protid *cred,
       goto out;
     }
 
-  err = 0;
   while (off + (off_t) datalen > np->allocsize)
     {
       err = diskfs_grow (np, off + datalen, cred);
diff --git a/libdiskfs/node-drop.c b/libdiskfs/node-drop.c
index 8a097da..83eb590 100644
--- a/libdiskfs/node-drop.c
+++ b/libdiskfs/node-drop.c
@@ -96,5 +96,3 @@ diskfs_drop_node (struct node *np)
   diskfs_node_norefs (np);
   pthread_spin_unlock (&diskfs_node_refcnt_lock);
 }
-
-      
diff --git a/libdiskfs/protid-make.c b/libdiskfs/protid-make.c
index 9b78a37..b39b92a 100644
--- a/libdiskfs/protid-make.c
+++ b/libdiskfs/protid-make.c
@@ -66,5 +66,3 @@ diskfs_create_protid (struct peropen *po, struct iouser *user,
     diskfs_finish_protid (*cred, user);
   return err;
 }
-
-
diff --git a/libdiskfs/protid-rele.c b/libdiskfs/protid-rele.c
index be74056..433b8c9 100644
--- a/libdiskfs/protid-rele.c
+++ b/libdiskfs/protid-rele.c
@@ -33,5 +33,3 @@ diskfs_protid_rele (void *arg)
     munmap (cred->mapped, vm_page_size);
   diskfs_release_peropen (cred->po);
 }
-
-  
diff --git a/libfshelp/fshelp.h b/libfshelp/fshelp.h
index a7702ca..5d3a0ce 100644
--- a/libfshelp/fshelp.h
+++ b/libfshelp/fshelp.h
@@ -1,5 +1,5 @@
 /* FS helper library definitions
-   Copyright (C) 1994,95,96,97,98,99,2000,01,02,13
+   Copyright (C) 1994,95,96,97,98,99,2000,01,02,13,14
      Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
@@ -34,14 +34,20 @@
 
 
 /* Keeping track of active translators */
-/* These routines keep a list of active translators.  They are
-   self-contained and do not require multi threading or the ports
-   library.  */
+/* These routines keep a list of active translators.  They do not
+   require multi threading but depend on the ports library.  */
+
+struct port_info;
 
 /* Record an active translator being bound to the given file name
-   NAME.  ACTIVE is the control port of the translator.  */
+   NAME.  ACTIVE is the control port of the translator.  PI references
+   a receive port that is used to request dead name notifications,
+   typically the port for the underlying node passed to the
+   translator.  */
 error_t
-fshelp_set_active_translator (const char *name, mach_port_t active);
+fshelp_set_active_translator (struct port_info *pi,
+                              const char *name,
+                              mach_port_t active);
 
 /* Remove the active translator specified by its control port ACTIVE.
    If there is no active translator with the given control port, this
diff --git a/libfshelp/get-identity.c b/libfshelp/get-identity.c
index 946b7e8..2dbd254 100644
--- a/libfshelp/get-identity.c
+++ b/libfshelp/get-identity.c
@@ -21,6 +21,8 @@
 
 #include <fshelp.h>
 #include <hurd/ports.h>
+#include <hurd/ihash.h>
+#include <stddef.h>
 #include <assert.h>
 
 static struct port_class *idclass = 0;
@@ -29,14 +31,26 @@ static pthread_mutex_t idlock = PTHREAD_MUTEX_INITIALIZER;
 struct idspec
 {
   struct port_info pi;
-  ino_t fileno;
+  hurd_ihash_locp_t id_hashloc;
 };
 
+static struct hurd_ihash idhash
+  = HURD_IHASH_INITIALIZER (offsetof (struct idspec, id_hashloc));
+
+static void
+id_clean (void *cookie)
+{
+  struct idspec *i = cookie;
+  pthread_mutex_lock (&idlock);
+  hurd_ihash_locp_remove (&idhash, i->id_hashloc);
+  pthread_mutex_unlock (&idlock);
+}
+
 static void
 id_initialize ()
 {
   assert (!idclass);
-  idclass = ports_create_class (0, 0);
+  idclass = ports_create_class (id_clean, NULL);
 }
 
 error_t
@@ -47,42 +61,32 @@ fshelp_get_identity (struct port_bucket *bucket,
   struct idspec *i;
   error_t err = 0;
 
-  error_t check_port (void *arg)
-    {
-      struct idspec *i = arg;
-      if (i->fileno == fileno)
-       {
-         *pt = ports_get_right (i);
-         return 1;
-       }
-      else
-       return 0;
-    }
-
   pthread_mutex_lock (&idlock);
   if (!idclass)
     id_initialize ();
 
-  *pt = MACH_PORT_NULL;
-
-  ports_class_iterate (idclass, check_port);
-
-  if (*pt != MACH_PORT_NULL)
+  i = hurd_ihash_find (&idhash, (hurd_ihash_key_t) fileno);
+  if (i == NULL)
     {
-      pthread_mutex_unlock (&idlock);
-      return 0;
+      err = ports_create_port (idclass, bucket, sizeof (struct idspec), &i);
+      if (err)
+        goto lose;
+      err = hurd_ihash_add (&idhash, (hurd_ihash_key_t) fileno, i);
+      if (err)
+        goto lose_port;
+
+      *pt = ports_get_right (i);
+      ports_port_deref (i);
     }
+  else
+    *pt = ports_get_right (i);
 
-  err = ports_create_port (idclass, bucket, sizeof (struct idspec), &i);
-  if (err)
-    {
-      pthread_mutex_unlock (&idlock);
-      return err;
-    }
-  i->fileno = fileno;
+  /* Success!  */
+  goto lose;
 
-  *pt = ports_get_right (i);
-  ports_port_deref (i);
+ lose_port:
+  ports_destroy_right (i);
+ lose:
   pthread_mutex_unlock (&idlock);
-  return 0;
+  return err;
 }
diff --git a/libfshelp/lock-acquire.c b/libfshelp/lock-acquire.c
index cdc6185..574bc5c 100644
--- a/libfshelp/lock-acquire.c
+++ b/libfshelp/lock-acquire.c
@@ -129,6 +129,3 @@ fshelp_acquire_lock (struct lock_box *box, int *user, 
pthread_mutex_t *mut,
     }
   return 0;
 }
-
-             
-         
diff --git a/libfshelp/set-active.c b/libfshelp/set-active.c
index 9776a52..00f2a18 100644
--- a/libfshelp/set-active.c
+++ b/libfshelp/set-active.c
@@ -60,4 +60,3 @@ fshelp_set_active (struct transbox *box,
   box->active = active;
   return 0;
 }
-
diff --git a/libfshelp/start-translator-long.c 
b/libfshelp/start-translator-long.c
index 55fb0ff..64a20be 100644
--- a/libfshelp/start-translator-long.c
+++ b/libfshelp/start-translator-long.c
@@ -285,10 +285,7 @@ fshelp_start_translator_long (fshelp_open_fn_t 
underlying_open_fn,
   ports[INIT_PORT_BOOTSTRAP] = saveport;
 
   if (err)
-    {
-      task_terminate (task);
-      goto lose;
-    }
+    goto lose_task;
 
   /* Ask to be told if TASK dies.  */
   err =
@@ -297,13 +294,17 @@ fshelp_start_translator_long (fshelp_open_fn_t 
underlying_open_fn,
                                   bootstrap, MACH_MSG_TYPE_MAKE_SEND_ONCE,
                                   &prev_notify);
   if (err)
-    return err;
+    goto lose_task;
 
   /* Ok, cool, we've got a running(?) program, now rendezvous with it if
      possible using the startup protocol on the bootstrap port... */
   err = service_fsys_startup(underlying_open_fn, cookie, bootstrap,
                             timeout, control, task);
 
+ lose_task:
+  if (err)
+    task_terminate (task);
+
  lose:
   if (!ports_moved)
     {
diff --git a/libfshelp/transbox-init.c b/libfshelp/transbox-init.c
index 42d953e..11a1ab4 100644
--- a/libfshelp/transbox-init.c
+++ b/libfshelp/transbox-init.c
@@ -32,4 +32,3 @@ fshelp_transbox_init (struct transbox *transbox,
   pthread_cond_init (&transbox->wakeup, NULL);
   transbox->cookie = cookie;
 }
-
diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c
index 87dcb21..3ece711 100644
--- a/libfshelp/translator-list.c
+++ b/libfshelp/translator-list.c
@@ -1,6 +1,6 @@
 /* A list of active translators.
 
-   Copyright (C) 2013 Free Software Foundation, Inc.
+   Copyright (C) 2013,14 Free Software Foundation, Inc.
 
    Written by Justus Winter <address@hidden>
 
@@ -22,6 +22,7 @@
 #include <argz.h>
 #include <hurd/fsys.h>
 #include <hurd/ihash.h>
+#include <hurd/ports.h>
 #include <mach.h>
 #include <mach/notify.h>
 #include <pthread.h>
@@ -33,6 +34,7 @@
 
 struct translator
 {
+  struct port_info *pi;
   char *name;
   mach_port_t active;
 };
@@ -49,8 +51,10 @@ translator_ihash_cleanup (void *element, void *arg)
 {
   struct translator *translator = element;
 
-  /* No need to deallocate port, we only keep the name of the
-     port, not a reference.  */
+  if (translator->pi)
+    ports_port_deref (translator->pi);
+  /* No need to deallocate translator->active, we only keep the name of
+     the port, not a reference.  */
   free (translator->name);
   free (translator);
 }
@@ -58,7 +62,9 @@ translator_ihash_cleanup (void *element, void *arg)
 /* Record an active translator being bound to the given file name
    NAME.  ACTIVE is the control port of the translator.  */
 error_t
-fshelp_set_active_translator (const char *name, mach_port_t active)
+fshelp_set_active_translator (struct port_info *pi,
+                             const char *name,
+                             mach_port_t active)
 {
   error_t err = 0;
   pthread_mutex_lock (&translator_ihash_lock);
@@ -79,6 +85,7 @@ fshelp_set_active_translator (const char *name, mach_port_t 
active)
     return ENOMEM;
 
   t->active = MACH_PORT_NULL;
+  t->pi = NULL;
   t->name = strdup (name);
   if (! t->name)
     {
@@ -93,9 +100,31 @@ fshelp_set_active_translator (const char *name, mach_port_t 
active)
 
  update:
   if (active)
-    /* No need to increment the reference count, we only keep the
-       name, not a reference.  */
-    t->active = active;
+    {
+      if (t->pi != pi)
+       {
+         mach_port_t old;
+         err = mach_port_request_notification (mach_task_self (), active,
+                                               MACH_NOTIFY_DEAD_NAME, 0,
+                                               pi->port_right,
+                                               MACH_MSG_TYPE_MAKE_SEND_ONCE,
+                                               &old);
+         if (err)
+           return err;
+         if (old != MACH_PORT_NULL)
+           mach_port_deallocate (mach_task_self (), old);
+
+         if (t->pi)
+           ports_port_deref (t->pi);
+
+         ports_port_ref (pi);
+         t->pi = pi;
+       }
+
+      /* No need to increment the reference count, we only keep the
+        name, not a reference.  */
+      t->active = active;
+    }
   else
     hurd_ihash_remove (&translator_ihash, (hurd_ihash_key_t) t);
 
diff --git a/libftpconn/names.c b/libftpconn/names.c
index 4536b72..9bf0767 100644
--- a/libftpconn/names.c
+++ b/libftpconn/names.c
@@ -235,4 +235,3 @@ ftp_conn_get_names (struct ftp_conn *conn, const char *name,
 
   return err;
 }
-
diff --git a/libihash/ihash.c b/libihash/ihash.c
index fe9eaed..d670fee 100644
--- a/libihash/ihash.c
+++ b/libihash/ihash.c
@@ -26,13 +26,11 @@
 #endif
 
 #include <errno.h>
-#include <string.h>
 #include <stdlib.h>
-#include <limits.h>
 #include <stdint.h>
 #include <assert.h>
 
-#include <hurd/ihash.h>
+#include "ihash.h"
 
 
 /* The prime numbers of the form 4 * i + 3 for some i, all greater
@@ -374,9 +372,6 @@ hurd_ihash_add (hurd_ihash_t ht, hurd_ihash_key_t key, 
hurd_ihash_value_t item)
 
   if (ht->items == NULL)
     {
-      if (ht->items)
-       free(ht->items);
-
       *ht = old_ht;
       return ENOMEM;
     }
diff --git a/libiohelp/handle_io_release_conch.c 
b/libiohelp/handle_io_release_conch.c
index 5be30a6..01328fe 100644
--- a/libiohelp/handle_io_release_conch.c
+++ b/libiohelp/handle_io_release_conch.c
@@ -41,4 +41,3 @@ iohelp_handle_io_release_conch (struct conch *c, void *user)
 
   pthread_cond_broadcast (&c->wait);
 }
-
diff --git a/libiohelp/initialize_conch.c b/libiohelp/initialize_conch.c
index 2ded241..50bab23 100644
--- a/libiohelp/initialize_conch.c
+++ b/libiohelp/initialize_conch.c
@@ -27,4 +27,3 @@ iohelp_initialize_conch (struct conch *c, pthread_mutex_t *m)
   c->holder = 0;
   c->holder_shared_page = 0;
 }
-
diff --git a/libiohelp/iouser-free.c b/libiohelp/iouser-free.c
index 19153da..0622960 100644
--- a/libiohelp/iouser-free.c
+++ b/libiohelp/iouser-free.c
@@ -26,5 +26,3 @@ iohelp_free_iouser (struct iouser *iouser)
   idvec_free (iouser->gids);
   free (iouser);
 }
-
-          
diff --git a/libnetfs/demuxer.c b/libnetfs/demuxer.c
index 6b4f727..8ef4d86 100644
--- a/libnetfs/demuxer.c
+++ b/libnetfs/demuxer.c
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 2013 Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -24,16 +24,24 @@ int
 netfs_demuxer (mach_msg_header_t *inp,
               mach_msg_header_t *outp)
 {
-  int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
-  int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
-  int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
-  int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *);
-
-  return (netfs_io_server (inp, outp)
-          || netfs_fs_server (inp, outp)
-          || ports_notify_server (inp, outp)
-          || netfs_fsys_server (inp, outp)
-          || ports_interrupt_server (inp, outp)
-          || netfs_ifsock_server (inp, outp));
+  mig_routine_t netfs_io_server_routine (mach_msg_header_t *);
+  mig_routine_t netfs_fs_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+  mig_routine_t netfs_fsys_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+  mig_routine_t netfs_ifsock_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = netfs_io_server_routine (inp)) ||
+      (routine = netfs_fs_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)) ||
+      (routine = netfs_fsys_server_routine (inp)) ||
+      (routine = ports_interrupt_server_routine (inp)) ||
+      (routine = netfs_ifsock_server_routine (inp)))
+    {
+      (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
-
diff --git a/libnetfs/dir-link.c b/libnetfs/dir-link.c
index 1c31b8f..637f4a3 100644
--- a/libnetfs/dir-link.c
+++ b/libnetfs/dir-link.c
@@ -40,5 +40,3 @@ netfs_S_dir_link (struct protid *diruser, struct protid 
*fileuser, char *name,
     mach_port_deallocate (mach_task_self (), fileuser->pi.port_right);
   return err;
 }
-
-  
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index 74351fa..99a8746 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1995,96,97,98,99,2000,01,02,13
+   Copyright (C) 1995,96,97,98,99,2000,01,02,13,14
      Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
@@ -67,6 +67,10 @@ netfs_S_dir_lookup (struct protid *diruser,
   if (! relpath)
     return ENOMEM;
 
+  /* Keep a pointer to the start of the filename for length
+     calculations.  */
+  char *filename_start = filename;
+
   *retry_port_type = MACH_MSG_TYPE_MAKE_SEND;
   *do_retry = FS_RETRY_NORMAL;
   *retry_name = '\0';
@@ -256,10 +260,16 @@ netfs_S_dir_lookup (struct protid *diruser,
                }
            }
 
+         boolean_t register_translator;
          if (! error)
            {
              dirport = ports_get_send_right (newpi);
-             ports_port_deref (newpi);
+
+             /* Check if an active translator is currently running.  If
+                not, fshelp_fetch_root will start one.  In that case, we
+                need to register it in the list of active
+                translators.  */
+             register_translator = np->transbox.active == MACH_PORT_NULL;
 
              error = fshelp_fetch_root (&np->transbox, diruser->po,
                                         dirport,
@@ -283,9 +293,38 @@ netfs_S_dir_lookup (struct protid *diruser,
                  strcat (retry_name, "/");
                  strcat (retry_name, nextname);
                }
+
+             if (register_translator)
+               {
+                 char *translator_path = strdupa (relpath);
+                 if (nextname != NULL)
+                   {
+                     /* This was not the last path component.
+                        NEXTNAME points to the next component, locate
+                        the end of the current component and use it
+                        to trim TRANSLATOR_PATH.  */
+                     char *end = nextname;
+                     while (*end != 0)
+                       end--;
+                     translator_path[end - filename_start] = '\0';
+                   }
+
+                 error = fshelp_set_active_translator (&newpi->pi,
+                                                       translator_path,
+                                                       np->transbox.active);
+                 if (error)
+                   {
+                     ports_port_deref (newpi);
+                     goto out;
+                   }
+               }
+
+             ports_port_deref (newpi);
              goto out;
            }
 
+         ports_port_deref (newpi);
+
          /* ENOENT means there was a hiccup, and the translator vanished
             while NP was unlocked inside fshelp_fetch_root; continue as 
normal. */
          error = 0;
diff --git a/libnetfs/dir-mkfile.c b/libnetfs/dir-mkfile.c
index 9e5847a..fcbc9da 100644
--- a/libnetfs/dir-mkfile.c
+++ b/libnetfs/dir-mkfile.c
@@ -61,4 +61,3 @@ netfs_S_dir_mkfile (struct protid *diruser, int flags, mode_t 
mode,
 
   return err;
 }
-
diff --git a/libnetfs/dir-rename.c b/libnetfs/dir-rename.c
index 0215376..2136219 100644
--- a/libnetfs/dir-rename.c
+++ b/libnetfs/dir-rename.c
@@ -40,4 +40,3 @@ netfs_S_dir_rename (struct protid *fromdiruser, char 
*fromname,
     mach_port_deallocate (mach_task_self (), todiruser->pi.port_right);
   return err;
 }
-
diff --git a/libnetfs/drop-node.c b/libnetfs/drop-node.c
index 5460149..2fe5ce9 100644
--- a/libnetfs/drop-node.c
+++ b/libnetfs/drop-node.c
@@ -27,5 +27,3 @@ netfs_drop_node (struct node *np)
   netfs_node_norefs (np);
   pthread_spin_unlock (&netfs_node_refcnt_lock);
 }
-
-  
diff --git a/libnetfs/file-chauthor.c b/libnetfs/file-chauthor.c
index 4f0aad0..7041b2b 100644
--- a/libnetfs/file-chauthor.c
+++ b/libnetfs/file-chauthor.c
@@ -35,4 +35,3 @@ netfs_S_file_chauthor (struct protid *user,
   pthread_mutex_unlock (&user->po->np->lock);
   return err;
 }
-
diff --git a/libnetfs/file-getlinknode.c b/libnetfs/file-getlinknode.c
index 9503d1d..a15c8d5 100644
--- a/libnetfs/file-getlinknode.c
+++ b/libnetfs/file-getlinknode.c
@@ -36,5 +36,3 @@ netfs_S_file_getlinknode (struct protid *user,
   *porttype = MACH_MSG_TYPE_MAKE_SEND;
   return 0;
 }
-
-      
diff --git a/libnetfs/file-set-size.c b/libnetfs/file-set-size.c
index b4a8cd2..1700ee1 100644
--- a/libnetfs/file-set-size.c
+++ b/libnetfs/file-set-size.c
@@ -37,4 +37,3 @@ netfs_S_file_set_size (struct protid *user,
   pthread_mutex_unlock (&user->po->np->lock);
   return err;
 }
-
diff --git a/libnetfs/file-set-translator.c b/libnetfs/file-set-translator.c
index a9883a3..b46eb02 100644
--- a/libnetfs/file-set-translator.c
+++ b/libnetfs/file-set-translator.c
@@ -1,5 +1,6 @@
 /*
-   Copyright (C) 1996, 1997, 1999, 2001, 2013 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2001, 2013, 2014
+     Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -175,20 +176,8 @@ netfs_S_file_set_translator (struct protid *user,
        }
     }
 
-  if (! err && user->po->path)
-    err = fshelp_set_active_translator (user->po->path, active);
-
-  if (! err && active != MACH_PORT_NULL)
-    {
-      mach_port_t old;
-      err = mach_port_request_notification (mach_task_self (), active,
-                                           MACH_NOTIFY_DEAD_NAME, 0,
-                                           user->pi.port_right,
-                                           MACH_MSG_TYPE_MAKE_SEND_ONCE,
-                                           &old);
-      if (old != MACH_PORT_NULL)
-       mach_port_deallocate (mach_task_self (), old);
-    }
+  if (! err && user->po->path && active_flags & FS_TRANS_SET)
+    err = fshelp_set_active_translator (&user->pi, user->po->path, active);
 
  out:
   pthread_mutex_unlock (&np->lock);
diff --git a/libnetfs/init-loop.c b/libnetfs/init-loop.c
index 08bdcd1..61471c2 100644
--- a/libnetfs/init-loop.c
+++ b/libnetfs/init-loop.c
@@ -41,4 +41,3 @@ netfs_server_loop ()
   
   exit (0);
 }
-
diff --git a/libnetfs/io-get-icky-async-id.c b/libnetfs/io-get-icky-async-id.c
index 49cae5e..23dac53 100644
--- a/libnetfs/io-get-icky-async-id.c
+++ b/libnetfs/io-get-icky-async-id.c
@@ -27,4 +27,3 @@ netfs_S_io_get_icky_async_id (struct protid *user, 
mach_port_t *pt,
 {
   return EOPNOTSUPP;
 }
-
diff --git a/libnetfs/io-seek.c b/libnetfs/io-seek.c
index cd2b3e4..1dc7d32 100644
--- a/libnetfs/io-seek.c
+++ b/libnetfs/io-seek.c
@@ -65,4 +65,3 @@ netfs_S_io_seek (struct protid *user,
 
   return err;
 }
-
diff --git a/libnetfs/io-stat.c b/libnetfs/io-stat.c
index cf2c25b..81e42bd 100644
--- a/libnetfs/io-stat.c
+++ b/libnetfs/io-stat.c
@@ -51,4 +51,3 @@ netfs_S_io_stat (struct protid *user, io_statbuf_t *statbuf)
 
   return err;
 }
-
diff --git a/libnetfs/io-write.c b/libnetfs/io-write.c
index 98c2a30..19bcf09 100644
--- a/libnetfs/io-write.c
+++ b/libnetfs/io-write.c
@@ -66,5 +66,3 @@ netfs_S_io_write (struct protid *user,
   
   return err;
 }
-
-
diff --git a/libnetfs/make-peropen.c b/libnetfs/make-peropen.c
index 7f2df05..f7be58b 100644
--- a/libnetfs/make-peropen.c
+++ b/libnetfs/make-peropen.c
@@ -66,4 +66,3 @@ netfs_make_peropen (struct node *np, int flags, struct 
peropen *context)
 
   return po;
 }
-
diff --git a/libnetfs/modes.h b/libnetfs/modes.h
index 53125f6..e5f52ed 100644
--- a/libnetfs/modes.h
+++ b/libnetfs/modes.h
@@ -20,4 +20,3 @@
 
 #include <fcntl.h>
 #define HONORED_STATE_MODES (O_APPEND|O_ASYNC|O_FSYNC|O_NONBLOCK|O_NOATIME)
-
diff --git a/libnetfs/mutations.h b/libnetfs/mutations.h
index 003bbe2..e6700f5 100644
--- a/libnetfs/mutations.h
+++ b/libnetfs/mutations.h
@@ -32,4 +32,3 @@
 #define IO_IMPORTS import "netfs.h"; import "priv.h";
 #define FSYS_IMPORTS import "netfs.h"; import "priv.h";
 #define IFSOCK_IMPORTS import "netfs.h"; import "priv.h";
-
diff --git a/libnetfs/nput.c b/libnetfs/nput.c
index 611b37a..522c714 100644
--- a/libnetfs/nput.c
+++ b/libnetfs/nput.c
@@ -35,4 +35,3 @@ netfs_nput (struct node *np)
       pthread_mutex_unlock (&np->lock);
     }
 }
-
diff --git a/libpager/Makefile b/libpager/Makefile
index 4d635b1..7c4da38 100644
--- a/libpager/Makefile
+++ b/libpager/Makefile
@@ -35,4 +35,3 @@ MIGSFLAGS = -DSEQNOS
 MIGCOMSFLAGS = -prefix _pager_
 
 include ../Makeconf
-
diff --git a/libpager/chg-compl.c b/libpager/chg-compl.c
index 890e89b..0b0c99c 100644
--- a/libpager/chg-compl.c
+++ b/libpager/chg-compl.c
@@ -53,5 +53,3 @@ _pager_seqnos_memory_object_change_completed (mach_port_t obj,
   ports_port_deref (p);
   return 0;
 }
-
-
diff --git a/libpager/no-senders.c b/libpager/no-senders.c
index 223cadd..83a2c88 100644
--- a/libpager/no-senders.c
+++ b/libpager/no-senders.c
@@ -39,5 +39,3 @@ _pager_do_seqnos_mach_notify_no_senders (mach_port_t notify,
   ports_port_deref (p);
   return 0;
 }
-
-
diff --git a/libpager/offer-page.c b/libpager/offer-page.c
index ef58c4b..9f090bc 100644
--- a/libpager/offer-page.c
+++ b/libpager/offer-page.c
@@ -49,4 +49,3 @@ pager_offer_page (struct pager *p,
 
   pthread_mutex_unlock (&p->interlock);
 }
-
diff --git a/libpager/pager-create.c b/libpager/pager-create.c
index 1aea6e9..1fc15b8 100644
--- a/libpager/pager-create.c
+++ b/libpager/pager-create.c
@@ -62,5 +62,3 @@ create_class ()
   _pager_class = ports_create_class (_pager_clean, _pager_real_dropweak);
   (void) &create_class;                /* Avoid warning */
 }
-
-
diff --git a/libpager/pager-flush.c b/libpager/pager-flush.c
index 55a76de..bd7697c 100644
--- a/libpager/pager-flush.c
+++ b/libpager/pager-flush.c
@@ -42,4 +42,3 @@ pager_flush_some (struct pager *p, vm_address_t offset,
   _pager_lock_object (p, offset, size, MEMORY_OBJECT_RETURN_NONE, 1,
                      VM_PROT_NO_CHANGE, wait);
 }
-  
diff --git a/libpager/pager-return.c b/libpager/pager-return.c
index b101305..7563d44 100644
--- a/libpager/pager-return.c
+++ b/libpager/pager-return.c
@@ -41,4 +41,3 @@ pager_return_some (struct pager *p, vm_address_t offset,
   _pager_lock_object (p, offset, size, MEMORY_OBJECT_RETURN_ALL, 1,
                      VM_PROT_NO_CHANGE, wait);
 }
-
diff --git a/libpager/pager-shutdown.c b/libpager/pager-shutdown.c
index 86c70af..c1aacfe 100644
--- a/libpager/pager-shutdown.c
+++ b/libpager/pager-shutdown.c
@@ -30,4 +30,3 @@ pager_shutdown (struct pager *p)
   ports_destroy_right (p);
   pthread_mutex_unlock (&p->interlock);
 }
-
diff --git a/libpager/pager-sync.c b/libpager/pager-sync.c
index d98a3ac..ec024b6 100644
--- a/libpager/pager-sync.c
+++ b/libpager/pager-sync.c
@@ -42,4 +42,3 @@ pager_sync_some (struct pager *p, vm_address_t offset,
   _pager_lock_object (p, offset, size, MEMORY_OBJECT_RETURN_ALL, 0,
                      VM_PROT_NO_CHANGE, wait);
 }
-  
diff --git a/libpipe/Makefile b/libpipe/Makefile
index 35e27ad..27a0d2d 100644
--- a/libpipe/Makefile
+++ b/libpipe/Makefile
@@ -29,4 +29,3 @@ HURDLIBS= ports
 LDLIBS += -lpthread
 
 include ../Makeconf
-
diff --git a/libports/begin-rpc.c b/libports/begin-rpc.c
index 1e0e8ed..142af98 100644
--- a/libports/begin-rpc.c
+++ b/libports/begin-rpc.c
@@ -106,5 +106,3 @@ ports_begin_rpc (void *portstruct, mach_msg_id_t msg_id, 
struct rpc_info *info)
 
   return 0;
 }
-
-  
diff --git a/libports/claim-right.c b/libports/claim-right.c
index 69d378f..4851ea3 100644
--- a/libports/claim-right.c
+++ b/libports/claim-right.c
@@ -50,4 +50,3 @@ ports_claim_right (void *portstruct)
 
   return ret;
 }
-
diff --git a/libports/complete-deallocate.c b/libports/complete-deallocate.c
index e569b46..8ce095b 100644
--- a/libports/complete-deallocate.c
+++ b/libports/complete-deallocate.c
@@ -49,4 +49,3 @@ _ports_complete_deallocate (struct port_info *pi)
   
   free (pi);
 }
-
diff --git a/libports/count-class.c b/libports/count-class.c
index 986a68b..0c48b46 100644
--- a/libports/count-class.c
+++ b/libports/count-class.c
@@ -31,6 +31,3 @@ ports_count_class (struct port_class *class)
   pthread_mutex_unlock (&_ports_lock);
   return ret;
 }
-
-  
-
diff --git a/libports/create-internal.c b/libports/create-internal.c
index 572a55a..8551297 100644
--- a/libports/create-internal.c
+++ b/libports/create-internal.c
@@ -118,4 +118,3 @@ _ports_create_port_internal (struct port_class *class,
 
   return err;
 }
-
diff --git a/libports/create-port-noinstall.c b/libports/create-port-noinstall.c
index 20c26a2..fd5a640 100644
--- a/libports/create-port-noinstall.c
+++ b/libports/create-port-noinstall.c
@@ -30,6 +30,3 @@ ports_create_port_noinstall (struct port_class *class,
 {
   return _ports_create_port_internal (class, bucket, size, result, 0);
 }
-
-
-
diff --git a/libports/create-port.c b/libports/create-port.c
index 4da92d4..104a18d 100644
--- a/libports/create-port.c
+++ b/libports/create-port.c
@@ -30,6 +30,3 @@ ports_create_port (struct port_class *class, struct 
port_bucket *bucket,
 {
   return _ports_create_port_internal (class, bucket, size, result, 1);
 }
-
-
-
diff --git a/libports/interrupt-notified-rpcs.c 
b/libports/interrupt-notified-rpcs.c
index 6d6493d..49a15d0 100644
--- a/libports/interrupt-notified-rpcs.c
+++ b/libports/interrupt-notified-rpcs.c
@@ -114,4 +114,3 @@ _ports_remove_notified_rpc (struct rpc_info *rpc)
       _ports_free_rpc_notifies = req;
     }
 }
-
diff --git a/libports/lookup-port.c b/libports/lookup-port.c
index 373d929..f79f6f0 100644
--- a/libports/lookup-port.c
+++ b/libports/lookup-port.c
@@ -50,5 +50,3 @@ ports_lookup_port (struct port_bucket *bucket,
   
   return pi;
 }
-
-  
diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
index 4003cfb..64e442f 100644
--- a/libports/manage-multithread.c
+++ b/libports/manage-multithread.c
@@ -20,6 +20,7 @@
 
 #include "ports.h"
 #include <assert.h>
+#include <error.h>
 #include <stdio.h>
 #include <mach/message.h>
 #include <mach/thread_info.h>
@@ -27,10 +28,6 @@
 
 #define STACK_SIZE (64 * 1024)
 
-/* FIXME Until threadvars are completely replaced with correct TLS, use this
-   hack to set the stack size.  */
-size_t __pthread_stack_default_size = STACK_SIZE;
-
 #define THREAD_PRI 2
 
 /* XXX To reduce starvation, the priority of new threads is initially
@@ -52,36 +49,44 @@ adjust_priority (unsigned int totalthreads)
   t = 10 + (((totalthreads - 1) / 100) + 1) * 10;
   thread_switch (MACH_PORT_NULL, SWITCH_OPTION_DEPRESS, t);
 
-  self = MACH_PORT_NULL;
-
   err = get_privileged_ports (&host_priv, NULL);
   if (err)
-    goto out;
+    goto error_host_priv;
 
   self = mach_thread_self ();
   err = thread_get_assignment (self, &pset);
   if (err)
-    goto out;
+    goto error_pset;
 
   err = host_processor_set_priv (host_priv, pset, &pset_priv);
   if (err)
-    goto out;
+    goto error_pset_priv;
 
   err = thread_max_priority (self, pset_priv, 0);
   if (err)
-    goto out;
+    goto error_max_priority;
 
   err = thread_priority (self, THREAD_PRI, 0);
-
-out:
-  if (self != MACH_PORT_NULL)
-    mach_port_deallocate (mach_task_self (), self);
-
-  if (err && err != EPERM)
-    {
-      errno = err;
-      perror ("unable to adjust libports thread priority");
-    }
+  if (err)
+    goto error_priority;
+
+  mach_port_deallocate (mach_task_self (), pset_priv);
+  mach_port_deallocate (mach_task_self (), pset);
+  mach_port_deallocate (mach_task_self (), self);
+  mach_port_deallocate (mach_task_self (), host_priv);
+  return;
+
+error_priority:
+error_max_priority:
+  mach_port_deallocate (mach_task_self (), pset_priv);
+error_pset_priv:
+  mach_port_deallocate (mach_task_self (), pset);
+error_pset:
+  mach_port_deallocate (mach_task_self (), self);
+  mach_port_deallocate (mach_task_self (), host_priv);
+error_host_priv:
+  if (err != EPERM)
+    error (0, err, "unable to adjust libports thread priority");
 }
 
 void
@@ -91,14 +96,16 @@ ports_manage_port_operations_multithread (struct 
port_bucket *bucket,
                                          int global_timeout,
                                          void (*hook)())
 {
-  volatile unsigned int nreqthreads;
-  volatile unsigned int totalthreads;
-  pthread_spinlock_t lock = PTHREAD_SPINLOCK_INITIALIZER;
+  /* totalthreads is the number of total threads created.  nreqthreads
+     is the number of threads not currently servicing any client.  The
+     initial values account for the main thread.  */
+  unsigned int totalthreads = 1;
+  unsigned int nreqthreads = 1;
+
   pthread_attr_t attr;
 
   auto void * thread_function (void *);
 
-  /* FIXME This is currently a no-op.  */
   pthread_attr_init (&attr);
   pthread_attr_setstacksize (&attr, STACK_SIZE);
 
@@ -120,29 +127,25 @@ ports_manage_port_operations_multithread (struct 
port_bucket *bucket,
                /* msgt_unused = */             0
        };
 
-      pthread_spin_lock (&lock);
-      assert (nreqthreads);
-      nreqthreads--;
-      if (nreqthreads != 0)
-       pthread_spin_unlock (&lock);
-      else
+      if (__atomic_sub_fetch (&nreqthreads, 1, __ATOMIC_RELAXED) == 0)
        /* No thread would be listening for requests, spawn one. */
        {
          pthread_t pthread_id;
          error_t err;
 
-         totalthreads++;
-         nreqthreads++;
-         pthread_spin_unlock (&lock);
+         __atomic_add_fetch (&totalthreads, 1, __ATOMIC_RELAXED);
+         __atomic_add_fetch (&nreqthreads, 1, __ATOMIC_RELAXED);
 
          err = pthread_create (&pthread_id, &attr, thread_function, NULL);
          if (!err)
            pthread_detach (pthread_id);
          else
            {
-             /* XXX The number of threads should be adjusted but the code
-                and design of the Hurd servers just don't handle thread
-                creation failure.  */
+             __atomic_sub_fetch (&totalthreads, 1, __ATOMIC_RELAXED);
+             __atomic_sub_fetch (&nreqthreads, 1, __ATOMIC_RELAXED);
+             /* There is not much we can do at this point.  The code
+                and design of the Hurd servers just don't handle
+                thread creation failure.  */
              errno = err;
              perror ("pthread_create");
            }
@@ -185,9 +188,7 @@ ports_manage_port_operations_multithread (struct 
port_bucket *bucket,
          status = 1;
        }
 
-      pthread_spin_lock (&lock);
-      nreqthreads++;
-      pthread_spin_unlock (&lock);
+      __atomic_add_fetch (&nreqthreads, 1, __ATOMIC_RELAXED);
 
       return status;
     }
@@ -199,8 +200,7 @@ ports_manage_port_operations_multithread (struct 
port_bucket *bucket,
       int timeout;
       error_t err;
 
-      /* No need to lock as an approximation is sufficient. */
-      adjust_priority (totalthreads);
+      adjust_priority (__atomic_load_n (&totalthreads, __ATOMIC_RELAXED));
 
       if (hook)
        (*hook) ();
@@ -220,35 +220,21 @@ ports_manage_port_operations_multithread (struct 
port_bucket *bucket,
 
       if (master)
        {
-         pthread_spin_lock (&lock);
-         if (totalthreads != 1)
-           {
-             pthread_spin_unlock (&lock);
-             goto startover;
-           }
+         if (__atomic_load_n (&totalthreads, __ATOMIC_RELAXED) != 1)
+           goto startover;
        }
       else
        {
-         pthread_spin_lock (&lock);
-         if (nreqthreads == 1)
+         if (__atomic_sub_fetch (&nreqthreads, 1, __ATOMIC_RELAXED) == 0)
            {
              /* No other thread is listening for requests, continue. */
-             pthread_spin_unlock (&lock);
+             __atomic_add_fetch (&nreqthreads, 1, __ATOMIC_RELAXED);
              goto startover;
            }
-         nreqthreads--;
-         totalthreads--;
-         pthread_spin_unlock (&lock);
+         __atomic_sub_fetch (&totalthreads, 1, __ATOMIC_RELAXED);
        }
       return NULL;
     }
 
-  nreqthreads = 1;
-  totalthreads = 1;
   thread_function ((void *) 1);
 }
-
-
-
-
-
diff --git a/libports/port-deref-weak.c b/libports/port-deref-weak.c
index 91071ff..beb4842 100644
--- a/libports/port-deref-weak.c
+++ b/libports/port-deref-weak.c
@@ -34,4 +34,3 @@ ports_port_deref_weak (void *portstruct)
   else
     pthread_mutex_unlock (&_ports_lock);
 }
-
diff --git a/libports/port-deref.c b/libports/port-deref.c
index ae10a02..cf9b238 100644
--- a/libports/port-deref.c
+++ b/libports/port-deref.c
@@ -48,5 +48,3 @@ ports_port_deref (void *portstruct)
   else
     pthread_mutex_unlock (&_ports_lock);
 }
-
-      
diff --git a/libports/port-ref.c b/libports/port-ref.c
index 864c540..92b7118 100644
--- a/libports/port-ref.c
+++ b/libports/port-ref.c
@@ -31,5 +31,3 @@ ports_port_ref (void *portstruct)
   pi->refcnt++;
   pthread_mutex_unlock (&_ports_lock);
 }
-
-  
diff --git a/libports/reallocate-from-external.c 
b/libports/reallocate-from-external.c
index cd12143..8cccb2a 100644
--- a/libports/reallocate-from-external.c
+++ b/libports/reallocate-from-external.c
@@ -60,7 +60,8 @@ ports_reallocate_from_external (void *portstruct, mach_port_t 
receive)
   pi->cancel_threshold = 0;
   pi->mscount = stat.mps_mscount;
   
-  hurd_ihash_add (&pi->bucket->htable, receive, pi);
+  err = hurd_ihash_add (&pi->bucket->htable, receive, pi);
+  assert_perror (err);
   pthread_mutex_unlock (&_ports_lock);
   
   mach_port_move_member (mach_task_self (), receive, pi->bucket->portset);
diff --git a/libports/reallocate-port.c b/libports/reallocate-port.c
index 891786c..d2adaeb 100644
--- a/libports/reallocate-port.c
+++ b/libports/reallocate-port.c
@@ -48,7 +48,8 @@ ports_reallocate_port (void *portstruct)
     }
   pi->cancel_threshold = 0;
   pi->mscount = 0;
-  hurd_ihash_add (&pi->bucket->htable, pi->port_right, pi);
+  err = hurd_ihash_add (&pi->bucket->htable, pi->port_right, pi);
+  assert_perror (err);
   pthread_mutex_unlock (&_ports_lock);
 
   err = mach_port_move_member (mach_task_self (), pi->port_right, 
@@ -58,8 +59,3 @@ ports_reallocate_port (void *portstruct)
   if (dropref)
     ports_port_deref (pi);
 }
-
-  
-
-                     
-    
diff --git a/libports/resume-all-rpcs.c b/libports/resume-all-rpcs.c
index e9669e0..e4befff 100644
--- a/libports/resume-all-rpcs.c
+++ b/libports/resume-all-rpcs.c
@@ -34,5 +34,3 @@ ports_resume_all_rpcs ()
     }
   pthread_mutex_unlock (&_ports_lock);
 }
-
-      
diff --git a/libports/resume-class-rpcs.c b/libports/resume-class-rpcs.c
index a8c701e..60a2b12 100644
--- a/libports/resume-class-rpcs.c
+++ b/libports/resume-class-rpcs.c
@@ -34,4 +34,3 @@ ports_resume_class_rpcs (struct port_class *class)
     }
   pthread_mutex_unlock (&_ports_lock);
 }
-
diff --git a/libports/resume-port-rpcs.c b/libports/resume-port-rpcs.c
index 5dc5c70..6d71ab5 100644
--- a/libports/resume-port-rpcs.c
+++ b/libports/resume-port-rpcs.c
@@ -37,6 +37,3 @@ ports_resume_port_rpcs (void *portstruct)
     }
   pthread_mutex_unlock (&_ports_lock);
 }
-
-
-  
diff --git a/libports/transfer-right.c b/libports/transfer-right.c
index 2a79069..72488a9 100644
--- a/libports/transfer-right.c
+++ b/libports/transfer-right.c
@@ -77,7 +77,8 @@ ports_transfer_right (void *tostruct,
   
   if (port)
     {
-      hurd_ihash_add (&topi->bucket->htable, port, topi);
+      err = hurd_ihash_add (&topi->bucket->htable, port, topi);
+      assert_perror (err);
       if (topi->bucket != frompi->bucket)
         {
          err = mach_port_move_member (mach_task_self (), port,
@@ -95,6 +96,3 @@ ports_transfer_right (void *tostruct,
     ports_port_deref (topi);
   return 0;
 }
-
-
-  
diff --git a/libps/procstat.c b/libps/procstat.c
index e688fa4..e732f75 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -352,6 +352,7 @@ summarize_thread_basic_info (struct procinfo *pi)
 {
   int i;
   unsigned num_threads = 0, num_run_threads = 0;
+  task_basic_info_t taskinfo = &pi->taskinfo;
   thread_basic_info_t tbi = malloc (sizeof (struct thread_basic_info));
   int run_base_priority = 0, run_cur_priority = 0;
   int total_base_priority = 0, total_cur_priority = 0;
@@ -426,6 +427,12 @@ summarize_thread_basic_info (struct procinfo *pi)
        }
     }
 
+  /* Include the run time of terminated threads.  */
+  tbi->user_time.seconds += taskinfo->user_time.seconds;
+  tbi->user_time.microseconds += taskinfo->user_time.microseconds;
+  tbi->system_time.seconds += taskinfo->system_time.seconds;
+  tbi->system_time.microseconds += taskinfo->system_time.microseconds;
+
   tbi->user_time.seconds += tbi->user_time.microseconds / 1000000;
   tbi->user_time.microseconds %= 1000000;
   tbi->system_time.seconds += tbi->system_time.microseconds / 1000000;
diff --git a/libps/spec.c b/libps/spec.c
index b34a234..146aba5 100644
--- a/libps/spec.c
+++ b/libps/spec.c
@@ -416,7 +416,7 @@ sprint_frac_value (char *buf,
 
   if (value >= 1000)            /* the integer part */
     value_len = 4;              /* values 1000-1023 */
-  if (value >= 100)            
+  else if (value >= 100)
     value_len = 3;
   else if (value >= 10)
     value_len = 2;
diff --git a/libshouldbeinlibc/cacheq.c b/libshouldbeinlibc/cacheq.c
index 5649903..c1be59c 100644
--- a/libshouldbeinlibc/cacheq.c
+++ b/libshouldbeinlibc/cacheq.c
@@ -19,7 +19,7 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
 
 #include "cacheq.h"
 
diff --git a/libshouldbeinlibc/canon-host.c b/libshouldbeinlibc/canon-host.c
index ea6c719..41068d3 100644
--- a/libshouldbeinlibc/canon-host.c
+++ b/libshouldbeinlibc/canon-host.c
@@ -20,7 +20,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <unistd.h>
 #include <string.h>
 #include <netdb.h>
 #include <netinet/in.h>
diff --git a/libshouldbeinlibc/fsysops.c b/libshouldbeinlibc/fsysops.c
index f26069d..dbcae67 100644
--- a/libshouldbeinlibc/fsysops.c
+++ b/libshouldbeinlibc/fsysops.c
@@ -25,6 +25,7 @@
 #include <mach.h>
 #include <sys/mman.h>
 #include <hurd/fsys.h>
+#include <string.h>
 
 /* Make FSYS readonly or writable.  */
 error_t
diff --git a/libshouldbeinlibc/idvec-auth.c b/libshouldbeinlibc/idvec-auth.c
index bb7f4af..1858bd6 100644
--- a/libshouldbeinlibc/idvec-auth.c
+++ b/libshouldbeinlibc/idvec-auth.c
@@ -22,6 +22,7 @@
 #include <mach.h>
 #include <sys/mman.h>
 #include <hurd/auth.h>
+#include <errno.h>
 
 #include "idvec.h"
 
diff --git a/libshouldbeinlibc/idvec.c b/libshouldbeinlibc/idvec.c
index d18871f..7fdee10 100644
--- a/libshouldbeinlibc/idvec.c
+++ b/libshouldbeinlibc/idvec.c
@@ -20,7 +20,8 @@
 
 #include <malloc.h>
 #include <string.h>
-#include <idvec.h>
+
+#include "idvec.h"
 
 /* Return a new, empty, idvec, or NULL if there wasn't enough memory.  */
 struct idvec *
diff --git a/libshouldbeinlibc/idvec.h b/libshouldbeinlibc/idvec.h
index abbc273..d6ec155 100644
--- a/libshouldbeinlibc/idvec.h
+++ b/libshouldbeinlibc/idvec.h
@@ -22,7 +22,6 @@
 
 #include <sys/types.h>
 #include <hurd/hurd_types.h>
-#include <errno.h>
 #include <string.h>
 #include <features.h>
 
diff --git a/libshouldbeinlibc/localhost.c b/libshouldbeinlibc/localhost.c
index f022511..9b7d4e0 100644
--- a/libshouldbeinlibc/localhost.c
+++ b/libshouldbeinlibc/localhost.c
@@ -19,9 +19,9 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <unistd.h>
-#include <malloc.h>
 #include <string.h>
 #include <errno.h>
+#include <stdlib.h>
 
 /* Return the name of the localhost.  This is just a wrapper for gethostname,
    which takes care of allocating a big enough buffer, and caches the result
diff --git a/libshouldbeinlibc/maptime.c b/libshouldbeinlibc/maptime.c
index cacf4b6..f0b69db 100644
--- a/libshouldbeinlibc/maptime.c
+++ b/libshouldbeinlibc/maptime.c
@@ -20,7 +20,6 @@
 
 #include <fcntl.h>
 #include <hurd.h>
-#include <mach.h>
 #include <device/device.h>
 
 #include "maptime.h"
@@ -43,15 +42,19 @@ maptime_map (int use_mach_dev, char *dev_name,
       mach_port_t device_master;
 
       err = get_privileged_ports (0, &device_master);
-      if (! err)
-       {
-         err = device_open (device_master, 0, dev_name ?: "time", &device);
-         mach_port_deallocate (mach_task_self (), device_master);
-         if (err)
-           return err;
-       }
+      if (err)
+       return err;
+
+      err = device_open (device_master, 0, dev_name ?: "time", &device);
+      mach_port_deallocate (mach_task_self (), device_master);
+      if (err)
+       return err;
 
       err = device_map (device, VM_PROT_READ, 0, sizeof *mtime, &memobj, 0);
+
+      /* Deallocate the device port.  The mapping is independent of
+        this port.  */
+      mach_port_deallocate (mach_task_self (), device);
     }
   else
     {
diff --git a/libshouldbeinlibc/nullauth.c b/libshouldbeinlibc/nullauth.c
index 4ba10a7..3a98e55 100644
--- a/libshouldbeinlibc/nullauth.c
+++ b/libshouldbeinlibc/nullauth.c
@@ -19,8 +19,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <error.h>
-#include <errno.h>
 #include <hurd.h>
 
 /* Obtain an empty authentication handle and use it for further
diff --git a/libshouldbeinlibc/portxlate.c b/libshouldbeinlibc/portxlate.c
index 599fb58..f78abbf 100644
--- a/libshouldbeinlibc/portxlate.c
+++ b/libshouldbeinlibc/portxlate.c
@@ -17,7 +17,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#include <malloc.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/mman.h>
 
@@ -35,7 +35,9 @@ port_name_xlator_create (mach_port_t from_task, mach_port_t 
to_task,
   if (! x)
     return ENOMEM;
 
+  mach_port_mod_refs (mach_task_self (), from_task, MACH_PORT_RIGHT_SEND, +1);
   x->from_task = from_task;
+  mach_port_mod_refs (mach_task_self (), to_task, MACH_PORT_RIGHT_SEND, +1);
   x->to_task = to_task;
   x->to_names = 0;
   x->to_types = 0;
@@ -64,6 +66,10 @@ port_name_xlator_create (mach_port_t from_task, mach_port_t 
to_task,
                  x->to_names_len * sizeof (mach_port_t));
          munmap ((caddr_t) x->to_types,
                  x->to_types_len * sizeof (mach_port_type_t));
+
+         mach_port_deallocate (mach_task_self (), x->to_task);
+         mach_port_deallocate (mach_task_self (), x->from_task);
+
          err = ENOMEM;
        }
     }
diff --git a/libshouldbeinlibc/shared-dom.c b/libshouldbeinlibc/shared-dom.c
index 0f8efdf..0115fce 100644
--- a/libshouldbeinlibc/shared-dom.c
+++ b/libshouldbeinlibc/shared-dom.c
@@ -18,10 +18,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <unistd.h>
-#include <malloc.h>
 #include <string.h>
-#include <errno.h>
 
 /* Returns a pointer into HOST1 that is the part of the domain shared with
    HOST2.  If the two do not share anything, the return value will point to
diff --git a/libshouldbeinlibc/timefmt.c b/libshouldbeinlibc/timefmt.c
index 7ce973b..a28f58b 100644
--- a/libshouldbeinlibc/timefmt.c
+++ b/libshouldbeinlibc/timefmt.c
@@ -338,8 +338,8 @@ fmt_past_time (struct timeval *tv, struct timeval *now,
 
              end = stpcpy (end, *dfmt);
              end = stpcpy (end, *sep);
-             end = stpcpy (end, *fmt);
-             
+             stpcpy (end, *fmt);
+
              used = strftime (buf, width + 1, whole_fmt, &tm);
            }
 
diff --git a/libshouldbeinlibc/ugids-argp.c b/libshouldbeinlibc/ugids-argp.c
index dc076d2..43a54d7 100644
--- a/libshouldbeinlibc/ugids-argp.c
+++ b/libshouldbeinlibc/ugids-argp.c
@@ -20,12 +20,11 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <hurd.h>
 #include <ctype.h>
-#include <unistd.h>
 #include <argp.h>
 #include <pwd.h>
 #include <grp.h>
+#include <errno.h>
 
 #include "ugids.h"
 
diff --git a/libshouldbeinlibc/ugids-auth.c b/libshouldbeinlibc/ugids-auth.c
index d7ec9da..0e4f84d 100644
--- a/libshouldbeinlibc/ugids-auth.c
+++ b/libshouldbeinlibc/ugids-auth.c
@@ -18,9 +18,9 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#include <stdlib.h>
 #include <hurd.h>
 
+#include "idvec.h"
 #include "ugids.h"
 
 /* Make an auth port from UGIDS and return it in AUTH, using authority in
diff --git a/libshouldbeinlibc/ugids-imply.c b/libshouldbeinlibc/ugids-imply.c
index 9c2a8a2..272ba66 100644
--- a/libshouldbeinlibc/ugids-imply.c
+++ b/libshouldbeinlibc/ugids-imply.c
@@ -18,8 +18,9 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#include <stdlib.h>
+#include <errno.h>
 
+#include "idvec.h"
 #include "ugids.h"
 
 /* Mark as implied all gids in UGIDS that can be implied from its uids.  */
diff --git a/libshouldbeinlibc/ugids-merge.c b/libshouldbeinlibc/ugids-merge.c
index 924e1ed..f97da07 100644
--- a/libshouldbeinlibc/ugids-merge.c
+++ b/libshouldbeinlibc/ugids-merge.c
@@ -18,8 +18,9 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#include <stdlib.h>
+#include <errno.h>
 
+#include "idvec.h"
 #include "ugids.h"
 
 static error_t
diff --git a/libshouldbeinlibc/ugids-subtract.c 
b/libshouldbeinlibc/ugids-subtract.c
index eecba20..b56e397 100644
--- a/libshouldbeinlibc/ugids-subtract.c
+++ b/libshouldbeinlibc/ugids-subtract.c
@@ -18,9 +18,9 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#include <stdlib.h>
-#include <stdio.h>
+#include <errno.h>
 
+#include "idvec.h"
 #include "ugids.h"
 
 /* Remove the gids in SUB from those in GIDS, except where they are implied
diff --git a/libshouldbeinlibc/ugids-verify-auth.c 
b/libshouldbeinlibc/ugids-verify-auth.c
index 28e3bda..0e85b1b 100644
--- a/libshouldbeinlibc/ugids-verify-auth.c
+++ b/libshouldbeinlibc/ugids-verify-auth.c
@@ -19,17 +19,12 @@
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
 
 #include <stdlib.h>
-#include <string.h>
 #include <hurd.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <argp.h>
-#include <pwd.h>
-#include <grp.h>
 
 #include <hurd/paths.h>
 #include <hurd/password.h>
 
+#include "idvec.h"
 #include "ugids.h"
 
 /* Accumulated information from authentication various passwords.  */
diff --git a/libshouldbeinlibc/ugids-verify.c b/libshouldbeinlibc/ugids-verify.c
index f9d45c6..5686bdf 100644
--- a/libshouldbeinlibc/ugids-verify.c
+++ b/libshouldbeinlibc/ugids-verify.c
@@ -18,15 +18,10 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
-#include <stdlib.h>
-#include <string.h>
 #include <hurd.h>
-#include <ctype.h>
-#include <unistd.h>
 #include <argp.h>
-#include <pwd.h>
-#include <grp.h>
 
+#include "idvec.h"
 #include "ugids.h"
 
 /* Verify that we have the right to the ids in UGIDS, given that we already
diff --git a/libshouldbeinlibc/ugids.c b/libshouldbeinlibc/ugids.c
index 2b9b6b7..db1ce3c 100644
--- a/libshouldbeinlibc/ugids.c
+++ b/libshouldbeinlibc/ugids.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "idvec.h"
 #include "ugids.h"
 
 /* Return a new ugids structure, or 0 if an allocation error occurs.  */
diff --git a/libshouldbeinlibc/ugids.h b/libshouldbeinlibc/ugids.h
index 10e7a24..5d0e113 100644
--- a/libshouldbeinlibc/ugids.h
+++ b/libshouldbeinlibc/ugids.h
@@ -24,6 +24,8 @@
 #include <stdlib.h>            /* For inline function stuff.  */
 #include <idvec.h>
 #include <features.h>
+#include <errno.h>
+#include <sys/types.h>
 
 #ifdef UGIDS_DEFINE_EI
 #define UGIDS_EI
diff --git a/libshouldbeinlibc/wire.c b/libshouldbeinlibc/wire.c
index bafc959..b954095 100644
--- a/libshouldbeinlibc/wire.c
+++ b/libshouldbeinlibc/wire.c
@@ -21,9 +21,9 @@
 
 #include <link.h>
 #include <dlfcn.h>
-#include <mach.h>
 #include <hurd.h>
 #include <error.h>
+#include <elf.h>
 
 #pragma weak _DYNAMIC
 #pragma weak dlopen
diff --git a/libshouldbeinlibc/wire.h b/libshouldbeinlibc/wire.h
index a7f6e89..6783cc5 100644
--- a/libshouldbeinlibc/wire.h
+++ b/libshouldbeinlibc/wire.h
@@ -24,4 +24,3 @@ void wire_task_self (void);
 
 /* Wire down all memory currently allocated at START for LEN bytes. */
 void wire_segment (vm_address_t start, vm_size_t len);
-
diff --git a/libthreads/Makefile.GNU b/libthreads/Makefile.GNU
index bff8ed1..fd33c9a 100644
--- a/libthreads/Makefile.GNU
+++ b/libthreads/Makefile.GNU
@@ -31,4 +31,3 @@ libthreads.a: $(OBJS)
        $(CPP) $(CPPFLAGS) $< > $*.as
        $(AS) -o $@ $*.as
        rm -f $*.as
-
diff --git a/libthreads/Makefile.GNU2 b/libthreads/Makefile.GNU2
index 7dead29..bcddc41 100644
--- a/libthreads/Makefile.GNU2
+++ b/libthreads/Makefile.GNU2
@@ -31,4 +31,3 @@ libthreads.a: $(OBJS)
        $(CPP) $(CPPFLAGS) $< > $*.as
        $(AS) -o $@ $*.as
        rm -f $*.as
-
diff --git a/libthreads/alpha/lock.S b/libthreads/alpha/lock.S
index 657ac1f..e7acb03 100644
--- a/libthreads/alpha/lock.S
+++ b/libthreads/alpha/lock.S
@@ -81,4 +81,3 @@ LEAF(spin_unlock,1)
        RET
 
        END(spin_unlock)
-
diff --git a/libtreefs/Makefile b/libtreefs/Makefile
index faec202..025040c 100644
--- a/libtreefs/Makefile
+++ b/libtreefs/Makefile
@@ -36,4 +36,3 @@ MIGCOMSFLAGS = -prefix treefs_
 notify-MIGSFLAGS = -DSEQNOS
 
 include ../Makeconf
-
diff --git a/libtreefs/s-fsys.c b/libtreefs/s-fsys.c
index c2b1835..e218a96 100644
--- a/libtreefs/s-fsys.c
+++ b/libtreefs/s-fsys.c
@@ -74,4 +74,3 @@ treefs_S_fsys_syncfs (fsys_t fsys_port, int wait, int recurse)
 {
   CALL_FSYS_HOOK(treefs_s_fsys_syncfs, fsys_port, wait, recurse);
 }
-
diff --git a/libtrivfs/demuxer.c b/libtrivfs/demuxer.c
index 2777746..411699f 100644
--- a/libtrivfs/demuxer.c
+++ b/libtrivfs/demuxer.c
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1993, 1994 Free Software Foundation
+   Copyright (C) 1993, 1994, 2013 Free Software Foundation
 
 This file is part of the GNU Hurd.
 
@@ -25,15 +25,23 @@ int
 trivfs_demuxer (mach_msg_header_t *inp,
                mach_msg_header_t *outp)
 {
-  int trivfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
-  int trivfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
-  int trivfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
-  
-  return (trivfs_io_server (inp, outp)
-         || trivfs_fs_server (inp, outp)
-         || ports_notify_server (inp, outp)
-         || trivfs_fsys_server (inp, outp)
-         || ports_interrupt_server (inp, outp));
+  mig_routine_t trivfs_io_server_routine (mach_msg_header_t *);
+  mig_routine_t trivfs_fs_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+  mig_routine_t trivfs_fsys_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+  mig_routine_t trivfs_ifsock_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = trivfs_io_server_routine (inp)) ||
+      (routine = trivfs_fs_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)) ||
+      (routine = trivfs_fsys_server_routine (inp)) ||
+      (routine = ports_interrupt_server_routine (inp)))
+    {
+      (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
-
-  
diff --git a/libtrivfs/protid-clean.c b/libtrivfs/protid-clean.c
index a9623a3..f98da6a 100644
--- a/libtrivfs/protid-clean.c
+++ b/libtrivfs/protid-clean.c
@@ -50,6 +50,3 @@ trivfs_clean_protid (void *arg)
   if (cred->realnode != MACH_PORT_NULL)
     mach_port_deallocate (mach_task_self (), cred->realnode);
 }
-
-  
-
diff --git a/libtrivfs/times.c b/libtrivfs/times.c
index d2fcc58..5f08cb1 100644
--- a/libtrivfs/times.c
+++ b/libtrivfs/times.c
@@ -46,7 +46,3 @@ trivfs_set_mtime (struct trivfs_control *cntl)
   file_utimes (cntl->underlying, atime, mtime);
   return 0;
 }
-
-
-
-  
diff --git a/mach-defpager/Makefile b/mach-defpager/Makefile
index 5a98d69..e38a0be 100644
--- a/mach-defpager/Makefile
+++ b/mach-defpager/Makefile
@@ -35,6 +35,3 @@ LDFLAGS += -static
 include ../Makeconf
 
 MIGSFLAGS = -DSEQNOS
-
-# Don't even bother.
-CFLAGS := $(filter-out -Wall,$(CFLAGS))
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index b445590..66b8587 100644
--- a/mach-defpager/default_pager.c
+++ b/mach-defpager/default_pager.c
@@ -48,6 +48,7 @@
 #include <default_pager.h>
 
 #include <assert.h>
+#include <errno.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -163,7 +164,7 @@ void set_partition_of(x, p)
 unsigned int
 part_id(const char *name)
 {
-       register unsigned int id, xorid;
+       unsigned int id, xorid;
        size_t len;
 
        len = strlen(name);
@@ -186,8 +187,8 @@ static partition_t
 new_partition (const char *name, struct file_direct *fdp,
               int check_linux_signature)
 {
-       register partition_t    part;
-       register vm_size_t      size, bmsize;
+       partition_t     part;
+       vm_size_t       size, bmsize;
        vm_offset_t raddr;
        mach_msg_type_number_t rsize;
        int rc;
@@ -436,7 +437,7 @@ create_paging_partition(const char *name,
                        struct file_direct *fdp, int isa_file,
                        int linux_signature)
 {
-       register partition_t    part;
+       partition_t     part;
 
        part = new_partition (name, fdp, linux_signature);
        if (!part)
@@ -444,14 +445,14 @@ create_paging_partition(const char *name,
 
        pthread_mutex_lock(&all_partitions.lock);
        {
-               register int i;
+               int i;
 
                for (i = 0; i < all_partitions.n_partitions; i++)
                        if (partition_of(i) == 0) break;
 
                if (i == all_partitions.n_partitions) {
-                       register partition_t    *new_list, *old_list;
-                       register int            n;
+                       partition_t     *new_list, *old_list;
+                       int             n;
 
                        n = i ? (i<<1) : 2;
                        new_list = (partition_t *)
@@ -486,11 +487,11 @@ create_paging_partition(const char *name,
 p_index_t
 choose_partition(size, cur_part)
        unsigned int            size;
-       register p_index_t      cur_part;
+       p_index_t       cur_part;
 {
-       register partition_t    part;
-       register boolean_t      found = FALSE;
-       register int            i;
+       partition_t     part;
+       boolean_t       found = FALSE;
+       int             i;
 
        pthread_mutex_lock(&all_partitions.lock);
        for (i = 0; i < all_partitions.n_partitions; i++) {
@@ -534,10 +535,10 @@ pager_alloc_page(pindex, lock_it)
        p_index_t       pindex;
        boolean_t       lock_it;
 {
-       register int    bm_e;
-       register int    bit;
-       register int    limit;
-       register bm_entry_t     *bm;
+       int     bm_e;
+       int     bit;
+       int     limit;
+       bm_entry_t      *bm;
        partition_t     part;
        static char     here[] = "%spager_alloc_page";
 
@@ -572,7 +573,7 @@ ddprintf ("pager_alloc_page(%d,%d)\n",pindex,lock_it);
         * Find and set the proper bit
         */
        {
-           register bm_entry_t b = *bm;
+           bm_entry_t  b = *bm;
 
            for (bit = 0; bit < NB_BM; bit++)
                if ((b & (1<<bit)) == 0)
@@ -596,11 +597,11 @@ ddprintf ("pager_alloc_page(%d,%d)\n",pindex,lock_it);
 void
 pager_dealloc_page(pindex, page, lock_it)
        p_index_t               pindex;
-       register vm_offset_t    page;
+       vm_offset_t     page;
        boolean_t               lock_it;
 {
-       register partition_t    part;
-       register int    bit, bm_e;
+       partition_t     part;
+       int     bit, bm_e;
 
        /* be paranoid */
        if (no_partition(pindex))
@@ -713,10 +714,10 @@ vm_size_t max_doubled_size = 4 * 1024 * 1024;     /* 4 
meg */
  * If there is no such map, than allocate it.
  */
 dp_map_t pager_get_direct_map(pager)
-       register dpager_t       pager;
+       dpager_t        pager;
 {
-       register dp_map_t       mapptr, emapptr;
-       register vm_size_t      size = pager->size;
+       dp_map_t        mapptr, emapptr;
+       vm_size_t       size = pager->size;
 
        if (pager->map)
            return pager->map;
@@ -724,7 +725,7 @@ dp_map_t pager_get_direct_map(pager)
         * Allocate and initialize the block map
         */
        {
-           register vm_size_t  alloc_size;
+           vm_size_t   alloc_size;
            dp_map_t            init_value;
 
            if (INDIRECT_PAGEMAP(size)) {
@@ -750,12 +751,12 @@ dp_map_t pager_get_direct_map(pager)
  */
 void
 pager_alloc(pager, part, size)
-       register dpager_t       pager;
+       dpager_t        pager;
        p_index_t               part;
-       register vm_size_t      size;   /* in BYTES */
+       vm_size_t       size;   /* in BYTES */
 {
-       register int    i;
-       register dp_map_t mapptr, emapptr;
+       int    i;
+       dp_map_t mapptr, emapptr;
 
        pthread_mutex_init(&pager->lock, NULL);
 #if    DEBUG_READER_CONFLICTS
@@ -803,10 +804,10 @@ pager_alloc(pager, part, size)
 
 vm_size_t
 pager_allocated(pager)
-       register dpager_t       pager;
+       dpager_t        pager;
 {
        vm_size_t       size;
-       register dp_map_t map, emap;
+       dp_map_t map, emap;
        vm_size_t       asize;
 
        size = pager->size;     /* in pages */
@@ -817,7 +818,7 @@ pager_allocated(pager)
                for (emap = &map[INDIRECT_PAGEMAP_ENTRIES(size)];
                     map < emap; map++) {
 
-                       register dp_map_t       map2, emap2;
+                       dp_map_t        map2, emap2;
 
                        if ((map2 = map->indirect) == 0)
                                continue;
@@ -846,7 +847,7 @@ pager_allocated(pager)
 unsigned int
 pager_pages(pager, pages, numpages)
        dpager_t                        pager;
-       register default_pager_page_t   *pages;
+       default_pager_page_t    *pages;
        unsigned int                    numpages;
 {
        vm_size_t       size;
@@ -863,7 +864,7 @@ pager_pages(pager, pages, numpages)
                for (emap = &map[INDIRECT_PAGEMAP_ENTRIES(size)];
                     map < emap; map++) {
 
-                       register dp_map_t       map2, emap2;
+                       dp_map_t        map2, emap2;
 
                        if ((map2 = map->indirect) == 0) {
                                offset += vm_page_size * PAGEMAP_ENTRIES;
@@ -878,12 +879,13 @@ pager_pages(pager, pages, numpages)
                        offset += vm_page_size;
                }
        } else {
-               for (emap = &map[size]; map < emap; map++)
+               for (emap = &map[size]; map < emap; map++) {
                        if ( ! no_block(*map) ) {
                                if (actual++ < numpages)
                                        pages++->dpp_offset = offset;
                        }
-               offset += vm_page_size;
+                       offset += vm_page_size;
+               }
        }
        return actual;
 }
@@ -898,13 +900,13 @@ pager_pages(pager, pages, numpages)
  */
 void
 pager_extend(pager, new_size)
-       register dpager_t       pager;
-       register vm_size_t      new_size;       /* in pages */
+       dpager_t        pager;
+       vm_size_t       new_size;       /* in pages */
 {
-       register dp_map_t       new_mapptr;
-       register dp_map_t       old_mapptr;
-       register int            i;
-       register vm_size_t      old_size;
+       dp_map_t        new_mapptr;
+       dp_map_t        old_mapptr;
+       int             i;
+       vm_size_t       old_size;
 
        pthread_mutex_lock(&pager->lock);       /* XXX lock_write */
 #if    DEBUG_READER_CONFLICTS
@@ -1061,6 +1063,29 @@ pager_extend(pager, new_size)
        pthread_mutex_unlock(&pager->lock);
 }
 
+/* This deallocates the pages necessary to truncate a direct map
+   previously of size NEW_SIZE to the smaller size OLD_SIZE.  */
+static void
+dealloc_direct (dp_map_t mapptr,
+               vm_size_t old_size, vm_size_t new_size)
+{
+  vm_size_t i;
+
+  if (!mapptr)
+    return;
+
+  for (i = new_size; i < old_size; ++i)
+    {
+      const union dp_map entry = mapptr[i];
+      if (!no_block(entry))
+       {
+         pager_dealloc_page(entry.block.p_index, entry.block.p_offset,
+                            TRUE);
+         invalidate_block(mapptr[i]);
+       }
+    }
+}
+
 /* Truncate a memory object.  First, any pages between the new size
    and the (larger) old size are deallocated.  Then, the size of
    the pagemap may be reduced, an indirect map may be turned into
@@ -1075,28 +1100,6 @@ pager_truncate(dpager_t pager, vm_size_t new_size)       
/* in pages */
   int i;
   vm_size_t old_size;
 
-  /* This deallocates the pages necessary to truncate a direct map
-     previously of size NEW_SIZE to the smaller size OLD_SIZE.  */
-  inline void dealloc_direct (dp_map_t mapptr,
-                             vm_size_t old_size, vm_size_t new_size)
-    {
-      vm_size_t i;
-
-      if (!mapptr)
-        return;
-
-      for (i = new_size; i < old_size; ++i)
-       {
-         const union dp_map entry = mapptr[i];
-         if (!no_block(entry))
-           {
-             pager_dealloc_page(entry.block.p_index, entry.block.p_offset,
-                                TRUE);
-             invalidate_block(mapptr[i]);
-           }
-       }
-    }
-
   pthread_mutex_lock(&pager->lock);    /* XXX lock_write */
 
   if (!pager->map)
@@ -1173,10 +1176,10 @@ pager_truncate(dpager_t pager, vm_size_t new_size)      
/* in pages */
  */
 union dp_map
 pager_read_offset(pager, offset)
-       register dpager_t       pager;
+       dpager_t        pager;
        vm_offset_t             offset;
 {
-       register vm_offset_t    f_page;
+       vm_offset_t     f_page;
        union dp_map            pager_offset;
 
        f_page = atop(offset);
@@ -1203,7 +1206,7 @@ pager_read_offset(pager, offset)
 
        invalidate_block(pager_offset);
        if (INDIRECT_PAGEMAP(pager->size)) {
-           register dp_map_t   mapptr;
+           dp_map_t    mapptr;
 
            if (pager->map) {
                mapptr = pager->map[f_page/PAGEMAP_ENTRIES].indirect;
@@ -1228,10 +1231,10 @@ pager_read_offset(pager, offset)
  * Release a single disk block.
  */
 void pager_release_offset(pager, offset)
-       register dpager_t       pager;
+       dpager_t        pager;
        vm_offset_t             offset;
 {
-       register union dp_map   entry;
+       union dp_map    entry;
 
        offset = atop(offset);
 
@@ -1239,7 +1242,7 @@ void pager_release_offset(pager, offset)
 
        assert (pager->map);
        if (INDIRECT_PAGEMAP(pager->size)) {
-               register dp_map_t       mapptr;
+               dp_map_t        mapptr;
 
                mapptr = pager->map[offset / PAGEMAP_ENTRIES].indirect;
                entry = mapptr[offset % PAGEMAP_ENTRIES];
@@ -1327,10 +1330,10 @@ ddprintf 
("pager_move_page(%x,%d,%d)\n",block.block.p_offset,old_pindex,new_pind
  */
 int
 pager_get_checksum(pager, offset)
-       register dpager_t       pager;
+       dpager_t        pager;
        vm_offset_t             offset;
 {
-       register vm_offset_t    f_page;
+       vm_offset_t     f_page;
        int checksum;
 
        f_page = atop(offset);
@@ -1340,7 +1343,7 @@ pager_get_checksum(pager, offset)
            panic("%spager_get_checksum",my_name);
 
        if (INDIRECT_PAGEMAP(pager->size)) {
-           register vm_offset_t *mapptr;
+           vm_offset_t *mapptr;
 
            mapptr = (vm_offset_t *)pager->checksum[f_page/PAGEMAP_ENTRIES];
            if (mapptr == 0)
@@ -1361,11 +1364,11 @@ pager_get_checksum(pager, offset)
  */
 int
 pager_put_checksum(pager, offset, checksum)
-       register dpager_t       pager;
+       dpager_t        pager;
        vm_offset_t             offset;
        int                     checksum;
 {
-       register vm_offset_t    f_page;
+       vm_offset_t     f_page;
        static char             here[] = "%spager_put_checksum";
 
        f_page = atop(offset);
@@ -1375,7 +1378,7 @@ pager_put_checksum(pager, offset, checksum)
            panic(here,my_name);
 
        if (INDIRECT_PAGEMAP(pager->size)) {
-           register vm_offset_t *mapptr;
+           vm_offset_t *mapptr;
 
            mapptr = (vm_offset_t *)pager->checksum[f_page/PAGEMAP_ENTRIES];
            if (mapptr == 0)
@@ -1397,9 +1400,9 @@ compute_checksum(addr, size)
        vm_offset_t     addr;
        vm_size_t       size;
 {
-       register int    checksum = NO_CHECKSUM;
-       register int    *ptr;
-       register int    count;
+       int     checksum = NO_CHECKSUM;
+       int     *ptr;
+       int     count;
 
        ptr = (int *)addr;
        count = size / sizeof(int);
@@ -1421,12 +1424,12 @@ compute_checksum(addr, size)
  */
 union dp_map
 pager_write_offset(pager, offset)
-       register dpager_t       pager;
+       dpager_t        pager;
        vm_offset_t             offset;
 {
-       register vm_offset_t    f_page;
-       register dp_map_t       mapptr;
-       register union dp_map   block;
+       vm_offset_t     f_page;
+       dp_map_t        mapptr;
+       union dp_map    block;
 
        invalidate_block(block);
 
@@ -1491,7 +1494,7 @@ pager_write_offset(pager, offset)
                /*
                 * Allocate the indirect block
                 */
-               register int i;
+               int i;
                ddprintf ("pager_write_offset: allocating indirect\n");
 
                mapptr = (dp_map_t) kalloc(PAGEMAP_SIZE(PAGEMAP_ENTRIES));
@@ -1505,8 +1508,8 @@ pager_write_offset(pager, offset)
                    invalidate_block(mapptr[i]);
 #ifdef CHECKSUM
                {
-                   register vm_offset_t *cksumptr;
-                   register int j;
+                   vm_offset_t *cksumptr;
+                   int j;
 
                    cksumptr = (vm_offset_t *)
                                kalloc(PAGEMAP_SIZE(PAGEMAP_ENTRIES));
@@ -1589,11 +1592,11 @@ out:
  */
 void
 pager_dealloc(pager)
-       register dpager_t       pager;
+       dpager_t        pager;
 {
-       register int i, j;
-       register dp_map_t       mapptr;
-       register union dp_map   block;
+       int i, j;
+       dp_map_t        mapptr;
+       union dp_map    block;
 
        if (!pager->map)
            return;
@@ -1650,10 +1653,10 @@ pager_dealloc(pager)
  */
 boolean_t
 pager_realloc(pager, pindex)
-       register dpager_t       pager;
+       dpager_t        pager;
        p_index_t               pindex;
 {
-       register dp_map_t       map, emap;
+       dp_map_t        map, emap;
        vm_size_t               size;
        union dp_map            block;
 
@@ -1667,7 +1670,7 @@ pager_realloc(pager, pindex)
                for (emap = &map[INDIRECT_PAGEMAP_ENTRIES(size)];
                     map < emap; map++) {
 
-                       register dp_map_t       map2, emap2;
+                       dp_map_t        map2, emap2;
 
                        if ((map2 = map->indirect) == 0)
                                continue;
@@ -1719,21 +1722,21 @@ ok:
  */
 int
 default_read(ds, addr, size, offset, out_addr, deallocate, external)
-       register dpager_t       ds;
+       dpager_t        ds;
        vm_offset_t             addr;   /* pointer to block to fill */
-       register vm_size_t      size;
-       register vm_offset_t    offset;
+       vm_size_t       size;
+       vm_offset_t     offset;
        vm_offset_t             *out_addr;
                                /* returns pointer to data */
        boolean_t               deallocate;
        boolean_t               external;
 {
-       register union dp_map   block;
+       union dp_map    block;
        vm_offset_t     raddr;
        vm_size_t       rsize;
-       register int    rc;
+       int     rc;
        boolean_t       first_time;
-       register partition_t    part;
+       partition_t     part;
 #ifdef CHECKSUM
        vm_size_t       original_size = size;
 #endif  /* CHECKSUM */
@@ -1817,15 +1820,15 @@ ddprintf 
("default_read(%x,%x,%x,%d)\n",addr,size,offset,block.block.p_index);
 
 int
 default_write(ds, addr, size, offset)
-       register dpager_t       ds;
-       register vm_offset_t    addr;
-       register vm_size_t      size;
-       register vm_offset_t    offset;
+       dpager_t        ds;
+       vm_offset_t     addr;
+       vm_size_t       size;
+       vm_offset_t     offset;
 {
-       register union dp_map   block;
+       union dp_map    block;
        partition_t             part;
        vm_size_t               wsize;
-       register int            rc;
+       int             rc;
 
        ddprintf ("default_write: pager offset %x\n", offset);
 
@@ -1990,8 +1993,8 @@ destroy_paging_partition(name, pp_private)
        char            *name;
        void **pp_private;
 {
-       register unsigned int   id = part_id(name);
-       register partition_t    part;
+       unsigned int    id = part_id(name);
+       partition_t     part;
        boolean_t               all_ok = TRUE;
        default_pager_t         entry;
        int                     pindex;
@@ -2397,7 +2400,7 @@ seqnos_memory_object_create(old_pager, seqno, new_pager, 
new_size,
        mach_port_t     new_pager_name;
        vm_size_t       new_page_size;
 {
-       register default_pager_t        ds;
+       default_pager_t ds;
        kern_return_t                   kr;
 
        assert(old_pager == default_pager_default_port);
@@ -2459,7 +2462,7 @@ seqnos_memory_object_init(pager, seqno, pager_request, 
pager_name,
        mach_port_t     pager_name;
        vm_size_t       pager_page_size;
 {
-       register default_pager_t ds;
+       default_pager_t ds;
        kern_return_t            kr;
        static char              here[] = "%sinit";
 
@@ -2505,8 +2508,7 @@ seqnos_memory_object_terminate(pager, seqno, 
pager_request, pager_name)
        mach_port_t     pager_request;
        mach_port_t     pager_name;
 {
-       register default_pager_t        ds;
-       mach_port_urefs_t               request_refs, name_refs;
+       default_pager_t ds;
        kern_return_t                   kr;
        static char                     here[] = "%sterminate";
 
@@ -2545,11 +2547,9 @@ ddprintf ("seqnos_memory_object_terminate <%p>: 
pager_port_lock: <%p>[s:%d,r:%d,
        if (ds->external)
                pager_request = ds->pager_request;
        ds->pager_request = MACH_PORT_NULL;
-       request_refs = ds->request_refs;
        ds->request_refs = 0;
        assert(ds->pager_name == pager_name);
        ds->pager_name = MACH_PORT_NULL;
-       name_refs = ds->name_refs;
        ds->name_refs = 0;
 ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_unlock: 
<%p>[s:%d,r:%d,w:%d,l:%d]\n",
        &kr, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held);
@@ -2570,7 +2570,7 @@ void default_pager_no_senders(pager, seqno, mscount)
        mach_port_seqno_t seqno;
        mach_port_mscount_t mscount;
 {
-       register default_pager_t ds;
+       default_pager_t ds;
        kern_return_t            kr;
        static char              here[] = "%sno_senders";
 
@@ -2866,7 +2866,7 @@ seqnos_memory_object_data_write(pager, seqno, 
pager_request,
             amount_sent < data_cnt;
             amount_sent += vm_page_size) {
 
-           register int result;
+           int result;
 
            result = default_write(&ds->dpager,
                              addr + amount_sent,
@@ -2987,7 +2987,7 @@ seqnos_memory_object_change_completed(pager, seqno, 
may_cache, copy_strategy)
 boolean_t default_pager_notify_server(in, out)
        mach_msg_header_t *in, *out;
 {
-       register mach_no_senders_notification_t *n =
+       mach_no_senders_notification_t *n =
                        (mach_no_senders_notification_t *) in;
 
        /*
@@ -3603,7 +3603,7 @@ not_this_one:
     nomemory:
 
        {
-               register int    i;
+               int     i;
                for (i = 0; i < num_pagers; i++)
                    (void) mach_port_deallocate(default_pager_self, ports[i]);
        }
@@ -3902,9 +3902,9 @@ void overcommitted(got_more_space, space)
 void paging_space_info(totp, freep)
        vm_size_t       *totp, *freep;
 {
-       register vm_size_t      total, free;
-       register partition_t    part;
-       register int            i;
+       vm_size_t       total, free;
+       partition_t     part;
+       int             i;
 
        total = free = 0;
        for (i = 0; i < all_partitions.n_partitions; i++) {
diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c
index db02c8d..777cd3d 100644
--- a/mach-defpager/kalloc.c
+++ b/mach-defpager/kalloc.c
@@ -92,7 +92,7 @@ boolean_t             kalloc_initialized = FALSE;
 
 void kalloc_init(void)
 {
-       register int i;
+       int i;
 
        /*
         * Support free lists for items up to vm_page_size or
@@ -185,9 +185,9 @@ vm_offset_t kget_space(vm_offset_t size)
 
 void *kalloc(vm_size_t size)
 {
-       register vm_size_t allocsize;
+       vm_size_t allocsize;
        vm_offset_t addr;
-       register struct free_list *fl;
+       struct free_list *fl;
 
        if (!kalloc_initialized) {
            kalloc_init();
@@ -237,8 +237,8 @@ void
 kfree( void *data,
        vm_size_t size)
 {
-       register vm_size_t freesize;
-       register struct free_list *fl;
+       vm_size_t freesize;
+       struct free_list *fl;
 
        freesize = size;
        if (size < kalloc_max) {
diff --git a/mach-defpager/queue.h b/mach-defpager/queue.h
index 0061917..17ea7e2 100644
--- a/mach-defpager/queue.h
+++ b/mach-defpager/queue.h
@@ -161,7 +161,7 @@ typedef     struct queue_entry      *queue_entry_t;
  */
 #define queue_enter(head, elt, type, field)                    \
 {                                                              \
-       register queue_entry_t prev;                            \
+       queue_entry_t prev;                             \
                                                                \
        prev = (head)->prev;                                    \
        if ((head) == prev) {                                   \
@@ -188,7 +188,7 @@ typedef     struct queue_entry      *queue_entry_t;
  */
 #define queue_enter_first(head, elt, type, field)              \
 {                                                              \
-       register queue_entry_t next;                            \
+       queue_entry_t next;                             \
                                                                \
        next = (head)->next;                                    \
        if ((head) == next) {                                   \
@@ -221,7 +221,7 @@ typedef     struct queue_entry      *queue_entry_t;
  */
 #define        queue_remove(head, elt, type, field)                    \
 {                                                              \
-       register queue_entry_t  next, prev;                     \
+       queue_entry_t   next, prev;                     \
                                                                \
        next = (elt)->field.next;                               \
        prev = (elt)->field.prev;                               \
@@ -248,7 +248,7 @@ typedef     struct queue_entry      *queue_entry_t;
  */
 #define        queue_remove_first(head, entry, type, field)            \
 {                                                              \
-       register queue_entry_t  next;                           \
+       queue_entry_t   next;                           \
                                                                \
        (entry) = (type) ((head)->next);                        \
        next = (entry)->field.next;                             \
@@ -271,7 +271,7 @@ typedef     struct queue_entry      *queue_entry_t;
  */
 #define        queue_remove_last(head, entry, type, field)             \
 {                                                              \
-       register queue_entry_t  prev;                           \
+       queue_entry_t   prev;                           \
                                                                \
        (entry) = (type) ((head)->prev);                        \
        prev = (entry)->field.prev;                             \
diff --git a/mach-defpager/wiring.c b/mach-defpager/wiring.c
index 8bf4993..883770f 100644
--- a/mach-defpager/wiring.c
+++ b/mach-defpager/wiring.c
@@ -79,7 +79,7 @@ wire_thread()
 void
 wire_all_memory()
 {
-       register kern_return_t kr;
+       kern_return_t kr;
        vm_offset_t     address;
        vm_size_t       size;
        vm_prot_t       protection;
diff --git a/nfs/cache.c b/nfs/cache.c
index 6e93257..506b90f 100644
--- a/nfs/cache.c
+++ b/nfs/cache.c
@@ -209,4 +209,3 @@ recache_handle (int *p, struct node *np)
   pthread_spin_unlock (&netfs_node_refcnt_lock);
   return p + len / sizeof (int);
 }
-
diff --git a/nfs/main.c b/nfs/main.c
index bb62351..3ce75a9 100644
--- a/nfs/main.c
+++ b/nfs/main.c
@@ -422,4 +422,3 @@ main (int argc, char **argv)
   for (;;)
     netfs_server_loop ();
 }
-
diff --git a/nfsd/Makefile b/nfsd/Makefile
index daaf86e..6ac6dd4 100644
--- a/nfsd/Makefile
+++ b/nfsd/Makefile
@@ -30,4 +30,3 @@ OTHERLIBS = -lpthread
 include ../Makeconf
 
 CPPFLAGS += -DLOCALSTATEDIR=\"$(localstatedir)\"
-
diff --git a/nfsd/ops.c b/nfsd/ops.c
index d503290..6e2cbb1 100644
--- a/nfsd/ops.c
+++ b/nfsd/ops.c
@@ -398,7 +398,7 @@ op_remove (struct cache_handle *c,
   err = dir_unlink (c->port, name);
   free (name);
 
-  return 0;
+  return err;
 }
 
 static error_t
diff --git a/nfsd/xdr.c b/nfsd/xdr.c
index 1ff7785..8b17559 100644
--- a/nfsd/xdr.c
+++ b/nfsd/xdr.c
@@ -215,4 +215,4 @@ nfs_error_trans (error_t err, int version)
          return NFSERR_IO;
        }
     }
-}      
+}
diff --git a/pfinet/dummy.c b/pfinet/dummy.c
index 523b218..b744f0f 100644
--- a/pfinet/dummy.c
+++ b/pfinet/dummy.c
@@ -132,7 +132,3 @@ setup_dummy_device (char *name, struct device **device)
   err = - register_netdevice (dev);
   assert_perror (err);
 }
-
-
-
-
diff --git a/pfinet/glue-include/linux/interrupt.h 
b/pfinet/glue-include/linux/interrupt.h
index df58d2f..22312ba 100644
--- a/pfinet/glue-include/linux/interrupt.h
+++ b/pfinet/glue-include/linux/interrupt.h
@@ -21,6 +21,7 @@ extern pthread_mutex_t net_bh_lock;
 
 /* See sched.c::net_bh_worker comments.  */
 extern pthread_cond_t net_bh_wakeup;
+extern int net_bh_raised;
 
 #define NET_BH 0xb00bee51
 
@@ -30,6 +31,7 @@ static inline void
 mark_bh (int bh)
 {
   assert (bh == NET_BH);
+  net_bh_raised = 1;
   pthread_cond_broadcast (&net_bh_wakeup);
 }
 
diff --git a/pfinet/linux-src/arch/i386/lib/checksum.S 
b/pfinet/linux-src/arch/i386/lib/checksum.S
index b48265d..3df2579 100644
--- a/pfinet/linux-src/arch/i386/lib/checksum.S
+++ b/pfinet/linux-src/arch/i386/lib/checksum.S
@@ -444,4 +444,4 @@ DST(        movb %dl, (%edi)         )
 #undef ROUND
 #undef ROUND1          
                
-#endif /* CPU==i686 */ 
+#endif /* CPU==i686 */
diff --git a/pfinet/linux-src/arch/i386/lib/old-checksum.c 
b/pfinet/linux-src/arch/i386/lib/old-checksum.c
index ae3a380..df74133 100644
--- a/pfinet/linux-src/arch/i386/lib/old-checksum.c
+++ b/pfinet/linux-src/arch/i386/lib/old-checksum.c
@@ -15,5 +15,3 @@ unsigned int csum_partial_copy( const char *src, char *dst, 
int len, int sum)
 
        return sum;
 }
-
-
diff --git a/pfinet/linux-src/arch/s390/lib/checksum.c 
b/pfinet/linux-src/arch/s390/lib/checksum.c
index 9411e1c..bb3b1ab 100644
--- a/pfinet/linux-src/arch/s390/lib/checksum.c
+++ b/pfinet/linux-src/arch/s390/lib/checksum.c
@@ -53,4 +53,3 @@ unsigned short csum_fold(unsigned int sum)
                 : "+d" (sum) : : "cc", "2", "3");
         return ((unsigned short) ~sum);
 }
-
diff --git a/pfinet/linux-src/arch/sparc64/lib/checksum.S 
b/pfinet/linux-src/arch/sparc64/lib/checksum.S
index ea732b3..c0f4356 100644
--- a/pfinet/linux-src/arch/sparc64/lib/checksum.S
+++ b/pfinet/linux-src/arch/sparc64/lib/checksum.S
@@ -275,4 +275,3 @@ cpc_handler:
        .section __ex_table
        .align  4
        .word  cpc_start, 0, cpc_end, cpc_handler
-
diff --git a/pfinet/linux-src/include/asm-s390/checksum.h 
b/pfinet/linux-src/include/asm-s390/checksum.h
index 487ccc9..c0f07d9 100644
--- a/pfinet/linux-src/include/asm-s390/checksum.h
+++ b/pfinet/linux-src/include/asm-s390/checksum.h
@@ -184,5 +184,3 @@ ip_compute_csum(unsigned char * buff, int len)
 }
 
 #endif /* _S390_CHECKSUM_H */
-
-
diff --git a/pfinet/linux-src/include/linux/busmouse.h 
b/pfinet/linux-src/include/linux/busmouse.h
index eb71550..eaa7b6b 100644
--- a/pfinet/linux-src/include/linux/busmouse.h
+++ b/pfinet/linux-src/include/linux/busmouse.h
@@ -101,4 +101,3 @@ struct mouse_status {
 /* Function Prototypes */
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/coda.h 
b/pfinet/linux-src/include/linux/coda.h
index 8cb3ff4..c194988 100644
--- a/pfinet/linux-src/include/linux/coda.h
+++ b/pfinet/linux-src/include/linux/coda.h
@@ -796,5 +796,4 @@ struct PioctlData {
 #define        IS_CTL_FID(fidp)        ((fidp)->Volume == CTL_VOL &&\
                                 (fidp)->Vnode == CTL_VNO &&\
                                 (fidp)->Unique == CTL_UNI)
-#endif 
-
+#endif
diff --git a/pfinet/linux-src/include/linux/digiPCI.h 
b/pfinet/linux-src/include/linux/digiPCI.h
index 6ca7819..834c703 100644
--- a/pfinet/linux-src/include/linux/digiPCI.h
+++ b/pfinet/linux-src/include/linux/digiPCI.h
@@ -35,8 +35,3 @@
 
 #define MEMOUTB(basemem, pnum, setmemval)  *(caddr_t)((basemem) + ( 
PCI_IO_OFFSET | pnum << 4 | pnum )) = (setmemval)
 #define MEMINB(basemem, pnum)  *(caddr_t)((basemem) + (PCI_IO_OFFSET | pnum << 
4 | pnum ))   /* for PCI I/O */
-
-
-
-
-
diff --git a/pfinet/linux-src/include/linux/dmascc.h 
b/pfinet/linux-src/include/linux/dmascc.h
index 01b46df..a00ef80 100644
--- a/pfinet/linux-src/include/linux/dmascc.h
+++ b/pfinet/linux-src/include/linux/dmascc.h
@@ -40,4 +40,3 @@ struct scc_param {
   int persist;  /* 0 ... 255 */
   int dma;      /* 1, 3 */
 };
-
diff --git a/pfinet/linux-src/include/linux/efs_dir.h 
b/pfinet/linux-src/include/linux/efs_dir.h
index 3315241..2123a4e 100644
--- a/pfinet/linux-src/include/linux/efs_dir.h
+++ b/pfinet/linux-src/include/linux/efs_dir.h
@@ -39,4 +39,3 @@ struct efs_dir {
 #define EFS_REALOFF(offset) ((offset << 1))
 
 #endif /* __EFS_DIR_H__ */
-
diff --git a/pfinet/linux-src/include/linux/efs_fs.h 
b/pfinet/linux-src/include/linux/efs_fs.h
index 1e5fd23..fef6cb9 100644
--- a/pfinet/linux-src/include/linux/efs_fs.h
+++ b/pfinet/linux-src/include/linux/efs_fs.h
@@ -64,4 +64,3 @@ extern int efs_bmap(struct inode *, int);
 extern int init_efs_fs(void);
 
 #endif /* __EFS_FS_H__ */
-
diff --git a/pfinet/linux-src/include/linux/efs_fs_i.h 
b/pfinet/linux-src/include/linux/efs_fs_i.h
index 453d706..e8e4070 100644
--- a/pfinet/linux-src/include/linux/efs_fs_i.h
+++ b/pfinet/linux-src/include/linux/efs_fs_i.h
@@ -65,4 +65,3 @@ struct efs_inode_info {
 };
 
 #endif /* __EFS_FS_I_H__ */
-
diff --git a/pfinet/linux-src/include/linux/efs_fs_sb.h 
b/pfinet/linux-src/include/linux/efs_fs_sb.h
index 9547666..cddc3bc 100644
--- a/pfinet/linux-src/include/linux/efs_fs_sb.h
+++ b/pfinet/linux-src/include/linux/efs_fs_sb.h
@@ -60,4 +60,3 @@ struct efs_sb_info {
 };
 
 #endif /* __EFS_FS_SB_H__ */
-
diff --git a/pfinet/linux-src/include/linux/efs_vh.h 
b/pfinet/linux-src/include/linux/efs_vh.h
index b9d7e4d..6b22ac5 100644
--- a/pfinet/linux-src/include/linux/efs_vh.h
+++ b/pfinet/linux-src/include/linux/efs_vh.h
@@ -67,4 +67,3 @@ struct pt_types {
 };
 
 #endif /* __EFS_VH_H__ */
-
diff --git a/pfinet/linux-src/include/linux/epca.h 
b/pfinet/linux-src/include/linux/epca.h
index 5049481..dbd72ad 100644
--- a/pfinet/linux-src/include/linux/epca.h
+++ b/pfinet/linux-src/include/linux/epca.h
@@ -167,4 +167,3 @@ struct board_info
        void ( * assertmemoff ) (struct channel *) ;
        unchar poller_inhibited ;
 };
-
diff --git a/pfinet/linux-src/include/linux/hayesesp.h 
b/pfinet/linux-src/include/linux/hayesesp.h
index 2ed3903..5641ef9 100644
--- a/pfinet/linux-src/include/linux/hayesesp.h
+++ b/pfinet/linux-src/include/linux/hayesesp.h
@@ -124,4 +124,3 @@ struct esp_pio_buffer {
 
 
 #endif /* ESP_H */
-
diff --git a/pfinet/linux-src/include/linux/ioctl.h 
b/pfinet/linux-src/include/linux/ioctl.h
index aa91eb3..7e55c36 100644
--- a/pfinet/linux-src/include/linux/ioctl.h
+++ b/pfinet/linux-src/include/linux/ioctl.h
@@ -4,4 +4,3 @@
 #include <asm/ioctl.h>
 
 #endif /* _LINUX_IOCTL_H */
-
diff --git a/pfinet/linux-src/include/linux/ipc.h 
b/pfinet/linux-src/include/linux/ipc.h
index 851ff4c..35e4f2b 100644
--- a/pfinet/linux-src/include/linux/ipc.h
+++ b/pfinet/linux-src/include/linux/ipc.h
@@ -45,5 +45,3 @@ struct ipc_perm
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_IPC_H */
-
-
diff --git a/pfinet/linux-src/include/linux/irda.h 
b/pfinet/linux-src/include/linux/irda.h
index 275d82f..e0eedbc 100644
--- a/pfinet/linux-src/include/linux/irda.h
+++ b/pfinet/linux-src/include/linux/irda.h
@@ -114,7 +114,3 @@ struct irda_ias_set {
 };
 
 #endif /* KERNEL_IRDA_H */
-
-
-
-
diff --git a/pfinet/linux-src/include/linux/isicom.h 
b/pfinet/linux-src/include/linux/isicom.h
index 58372fd..a7dc2f8 100644
--- a/pfinet/linux-src/include/linux/isicom.h
+++ b/pfinet/linux-src/include/linux/isicom.h
@@ -307,4 +307,3 @@ extern inline void kill_queue(struct isi_port * port, short 
queue)
 #endif /*      __KERNEL__      */
 
 #endif /*      ISICOM_H        */
-
diff --git a/pfinet/linux-src/include/linux/kmod.h 
b/pfinet/linux-src/include/linux/kmod.h
index 7392910..4968394 100644
--- a/pfinet/linux-src/include/linux/kmod.h
+++ b/pfinet/linux-src/include/linux/kmod.h
@@ -9,4 +9,3 @@ extern int request_module(const char * name);
 #else
 #define request_module(x) do {} while(0)
 #endif
-
diff --git a/pfinet/linux-src/include/linux/locks.h 
b/pfinet/linux-src/include/linux/locks.h
index 2094a4d..07ac4fa 100644
--- a/pfinet/linux-src/include/linux/locks.h
+++ b/pfinet/linux-src/include/linux/locks.h
@@ -59,4 +59,3 @@ extern inline void unlock_super(struct super_block * sb)
 }
 
 #endif /* _LINUX_LOCKS_H */
-
diff --git a/pfinet/linux-src/include/linux/lp_intern.h 
b/pfinet/linux-src/include/linux/lp_intern.h
index c7af535..56ac21d 100644
--- a/pfinet/linux-src/include/linux/lp_intern.h
+++ b/pfinet/linux-src/include/linux/lp_intern.h
@@ -19,4 +19,3 @@
 int lp_internal_init(void);
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/lp_mfc.h 
b/pfinet/linux-src/include/linux/lp_mfc.h
index cf8cfb4..02f735e 100644
--- a/pfinet/linux-src/include/linux/lp_mfc.h
+++ b/pfinet/linux-src/include/linux/lp_mfc.h
@@ -11,4 +11,3 @@
 int lp_mfc_init(void);
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/ncp_fs_sb.h 
b/pfinet/linux-src/include/linux/ncp_fs_sb.h
index 43f902b..1f8b85f 100644
--- a/pfinet/linux-src/include/linux/ncp_fs_sb.h
+++ b/pfinet/linux-src/include/linux/ncp_fs_sb.h
@@ -93,4 +93,3 @@ static inline void ncp_invalidate_conn(struct ncp_server 
*server)
 #endif                         /* __KERNEL__ */
 
 #endif
- 
diff --git a/pfinet/linux-src/include/linux/ntfs_fs.h 
b/pfinet/linux-src/include/linux/ntfs_fs.h
index acbfc29..aafdb78 100644
--- a/pfinet/linux-src/include/linux/ntfs_fs.h
+++ b/pfinet/linux-src/include/linux/ntfs_fs.h
@@ -4,4 +4,3 @@
 int init_ntfs_fs(void);
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/nubus.h 
b/pfinet/linux-src/include/linux/nubus.h
index c09b95a..73aafeb 100644
--- a/pfinet/linux-src/include/linux/nubus.h
+++ b/pfinet/linux-src/include/linux/nubus.h
@@ -93,4 +93,3 @@ extern int nubus_hwreg_present(volatile void *ptr);
 extern void nubus_init_via(void);
 extern int nubus_free_irq(int slot);
 extern int nubus_request_irq(int slot, void *dev_id, void (*handler)(int,void 
*,struct pt_regs *));
-
diff --git a/pfinet/linux-src/include/linux/route.h 
b/pfinet/linux-src/include/linux/route.h
index e670dba..6d1b8e3 100644
--- a/pfinet/linux-src/include/linux/route.h
+++ b/pfinet/linux-src/include/linux/route.h
@@ -67,4 +67,3 @@ struct rtentry
 
 
 #endif /* _LINUX_ROUTE_H */
-
diff --git a/pfinet/linux-src/include/linux/sdla_fr.h 
b/pfinet/linux-src/include/linux/sdla_fr.h
index f5aef96..1c45c61 100644
--- a/pfinet/linux-src/include/linux/sdla_fr.h
+++ b/pfinet/linux-src/include/linux/sdla_fr.h
@@ -635,4 +635,3 @@ typedef struct {
 #  pragma      pack()
 #endif
 #endif /* _SDLA_FR_H */
-
diff --git a/pfinet/linux-src/include/linux/sdlapci.h 
b/pfinet/linux-src/include/linux/sdlapci.h
index 857fd06..e65783d 100644
--- a/pfinet/linux-src/include/linux/sdlapci.h
+++ b/pfinet/linux-src/include/linux/sdlapci.h
@@ -65,4 +65,3 @@
 #define MAX_S514_CARDS         8
 
 #endif /* _SDLAPCI_H */
-
diff --git a/pfinet/linux-src/include/linux/sdlasfm.h 
b/pfinet/linux-src/include/linux/sdlasfm.h
index 94aaa8a..c82d31a 100644
--- a/pfinet/linux-src/include/linux/sdlasfm.h
+++ b/pfinet/linux-src/include/linux/sdlasfm.h
@@ -101,4 +101,3 @@ typedef struct sfm                  /* SDLA firmware file 
structire */
 } sfm_t;
 
 #endif /* _SDLASFM_H */
-
diff --git a/pfinet/linux-src/include/linux/serial_reg.h 
b/pfinet/linux-src/include/linux/serial_reg.h
index 713227a..20ab574 100644
--- a/pfinet/linux-src/include/linux/serial_reg.h
+++ b/pfinet/linux-src/include/linux/serial_reg.h
@@ -141,4 +141,3 @@
  */
 
 #endif /* _LINUX_SERIAL_REG_H */
-
diff --git a/pfinet/linux-src/include/linux/sysv_fs.h 
b/pfinet/linux-src/include/linux/sysv_fs.h
index 49d9d24..b34296c 100644
--- a/pfinet/linux-src/include/linux/sysv_fs.h
+++ b/pfinet/linux-src/include/linux/sysv_fs.h
@@ -411,4 +411,3 @@ extern struct inode_operations 
sysv_symlink_inode_operations;
 #endif /* __KERNEL__ */
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/sysv_fs_i.h 
b/pfinet/linux-src/include/linux/sysv_fs_i.h
index 990b354..c2b578af 100644
--- a/pfinet/linux-src/include/linux/sysv_fs_i.h
+++ b/pfinet/linux-src/include/linux/sysv_fs_i.h
@@ -13,4 +13,3 @@ struct sysv_inode_info {
 };
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/sysv_fs_sb.h 
b/pfinet/linux-src/include/linux/sysv_fs_sb.h
index df886f6..61af159 100644
--- a/pfinet/linux-src/include/linux/sysv_fs_sb.h
+++ b/pfinet/linux-src/include/linux/sysv_fs_sb.h
@@ -119,4 +119,3 @@ struct sysv_sb_info {
 #define sv_nzones                              u.sysv_sb.s_nzones
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/tpqic02.h 
b/pfinet/linux-src/include/linux/tpqic02.h
index 790e0e5..8817f11 100644
--- a/pfinet/linux-src/include/linux/tpqic02.h
+++ b/pfinet/linux-src/include/linux/tpqic02.h
@@ -736,4 +736,3 @@ extern int qic02_tape_init(void);                     /* 
for mem.c */
 #endif /* CONFIG_QIC02_TAPE */
 
 #endif /* _LINUX_TPQIC02_H */
-
diff --git a/pfinet/linux-src/include/linux/tty_flip.h 
b/pfinet/linux-src/include/linux/tty_flip.h
index 948e545..daea800 100644
--- a/pfinet/linux-src/include/linux/tty_flip.h
+++ b/pfinet/linux-src/include/linux/tty_flip.h
@@ -26,10 +26,3 @@ _INLINE_ void tty_schedule_flip(struct tty_struct *tty)
 
 
 #endif /* _LINUX_TTY_FLIP_H */
-
-
-
-
-
-
-
diff --git a/pfinet/linux-src/include/linux/vmalloc.h 
b/pfinet/linux-src/include/linux/vmalloc.h
index 340544f..ae59dc0 100644
--- a/pfinet/linux-src/include/linux/vmalloc.h
+++ b/pfinet/linux-src/include/linux/vmalloc.h
@@ -21,4 +21,3 @@ void vmfree_area_pages(unsigned long address, unsigned long 
size);
 int vmalloc_area_pages(unsigned long address, unsigned long size);
 
 #endif
-
diff --git a/pfinet/linux-src/include/linux/wanpipe.h 
b/pfinet/linux-src/include/linux/wanpipe.h
index f0dbd6f..d3b61f4 100644
--- a/pfinet/linux-src/include/linux/wanpipe.h
+++ b/pfinet/linux-src/include/linux/wanpipe.h
@@ -369,4 +369,3 @@ int wpft1_init (sdla_t* card, wandev_conf_t* conf);     /* 
FT1 Config support */
 
 #endif /* __KERNEL__ */
 #endif /* _WANPIPE_H */
-
diff --git a/pfinet/linux-src/include/net/br.h 
b/pfinet/linux-src/include/net/br.h
index cbf4b4c..95effc5 100644
--- a/pfinet/linux-src/include/net/br.h
+++ b/pfinet/linux-src/include/net/br.h
@@ -326,6 +326,3 @@ extern struct br_stat br_stats;
 extern Port_data port_info[];
 
 #endif
-
-
- 
diff --git a/pfinet/linux-src/include/net/inet_common.h 
b/pfinet/linux-src/include/net/inet_common.h
index 9c7c8b9..80a6b34 100644
--- a/pfinet/linux-src/include/net/inet_common.h
+++ b/pfinet/linux-src/include/net/inet_common.h
@@ -41,5 +41,3 @@ extern int                    inet_fcntl(struct socket *sock,
 extern int                     inet_listen(struct socket *sock, int backlog);
 
 #endif
-
-
diff --git a/pfinet/linux-src/include/net/ipv6.h 
b/pfinet/linux-src/include/net/ipv6.h
index 77520ee..60ea053 100644
--- a/pfinet/linux-src/include/net/ipv6.h
+++ b/pfinet/linux-src/include/net/ipv6.h
@@ -323,6 +323,3 @@ extern void                 ipv6_local_error(struct sock 
*sk, int err, struct flowi *fl, u32 i
 
 #endif /* __KERNEL__ */
 #endif /* _NET_IPV6_H */
-
-
-
diff --git a/pfinet/linux-src/include/net/llc.h 
b/pfinet/linux-src/include/net/llc.h
index 654a658..e88e8dc 100644
--- a/pfinet/linux-src/include/net/llc.h
+++ b/pfinet/linux-src/include/net/llc.h
@@ -132,4 +132,3 @@ void                llc_test_request(llcptr lp, int 
data_len, char *pdu_data);
 int            register_cl2llc_client(llcptr llc, const char *device, void 
(*ops)(llcptr), u8 *rmac, u8 ssap, u8 dsap);
 void           unregister_cl2llc_client(llcptr lp);
 int            llc_mac_data_indicate(llcptr lp, struct sk_buff *skb );
-
diff --git a/pfinet/linux-src/include/net/llc_name.h 
b/pfinet/linux-src/include/net/llc_name.h
index 7212871..c78d2ac 100644
--- a/pfinet/linux-src/include/net/llc_name.h
+++ b/pfinet/linux-src/include/net/llc_name.h
@@ -4,4 +4,3 @@ char *frame_names[] =
     "UA_RSP","DM_RSP","FRMR_RSP","BAD_FRAME","UI_CMD",
     "XID_CMD","TEST_CMD","XID_RSP","TEST_RSP"
 };
- 
diff --git a/pfinet/linux-src/include/net/llccall.h 
b/pfinet/linux-src/include/net/llccall.h
index 07013ba..94bdfb0 100644
--- a/pfinet/linux-src/include/net/llccall.h
+++ b/pfinet/linux-src/include/net/llccall.h
@@ -1,3 +1,2 @@
 /* Separate to keep compilation of protocols.c simpler */
 extern void llc_init(struct net_proto *pro);
-
diff --git a/pfinet/linux-src/include/net/neighbour.h 
b/pfinet/linux-src/include/net/neighbour.h
index 5c5d90b..ab79f17 100644
--- a/pfinet/linux-src/include/net/neighbour.h
+++ b/pfinet/linux-src/include/net/neighbour.h
@@ -268,5 +268,3 @@ extern __inline__ void neigh_table_unlock(struct 
neigh_table *tbl)
 
 #endif
 #endif
-
-
diff --git a/pfinet/linux-src/include/net/rarp.h 
b/pfinet/linux-src/include/net/rarp.h
index 7bfb08e..7842d97 100644
--- a/pfinet/linux-src/include/net/rarp.h
+++ b/pfinet/linux-src/include/net/rarp.h
@@ -9,4 +9,3 @@ extern int rarp_get_info(char *buffer,
                         int length,
                         int dummy);
 #endif /* _RARP_H */
-
diff --git a/pfinet/linux-src/include/net/scm.h 
b/pfinet/linux-src/include/net/scm.h
index 98c2dc9..f9feff5 100644
--- a/pfinet/linux-src/include/net/scm.h
+++ b/pfinet/linux-src/include/net/scm.h
@@ -64,4 +64,3 @@ static __inline__ void scm_recv(struct socket *sock, struct 
msghdr *msg,
 
 
 #endif __LINUX_NET_SCM_H
-
diff --git a/pfinet/linux-src/net/core/dev_mcast.c 
b/pfinet/linux-src/net/core/dev_mcast.c
index bce3f4a..0a67b53 100644
--- a/pfinet/linux-src/net/core/dev_mcast.c
+++ b/pfinet/linux-src/net/core/dev_mcast.c
@@ -249,4 +249,3 @@ __initfunc(void dev_mcast_init(void))
        ent->read_proc = dev_mc_read_proc;
 #endif
 }
-
diff --git a/pfinet/linux-src/net/ipv4/Config.in 
b/pfinet/linux-src/net/ipv4/Config.in
index 8982bc1..d1c7a5f 100644
--- a/pfinet/linux-src/net/ipv4/Config.in
+++ b/pfinet/linux-src/net/ipv4/Config.in
@@ -82,4 +82,3 @@ bool 'IP: Allow large windows (not recommended if <16Mb of 
memory)' CONFIG_SKB_L
 #if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then 
 #bool 'IP: support experimental checksum copy to user for UDP'  
CONFIG_UDP_DELAY_CSUM
 #fi
-
diff --git a/pfinet/linux-src/net/ipv4/fib_frontend.c 
b/pfinet/linux-src/net/ipv4/fib_frontend.c
index a174704..ec139eb 100644
--- a/pfinet/linux-src/net/ipv4/fib_frontend.c
+++ b/pfinet/linux-src/net/ipv4/fib_frontend.c
@@ -625,4 +625,3 @@ __initfunc(void ip_fib_init(void))
        register_netdevice_notifier(&fib_netdev_notifier);
        register_inetaddr_notifier(&fib_inetaddr_notifier);
 }
-
diff --git a/pfinet/linux-src/net/ipv4/igmp.c b/pfinet/linux-src/net/ipv4/igmp.c
index 934e860..4626910 100644
--- a/pfinet/linux-src/net/ipv4/igmp.c
+++ b/pfinet/linux-src/net/ipv4/igmp.c
@@ -695,4 +695,3 @@ done:
        return len;
 }
 #endif
-
diff --git a/pfinet/linux-src/net/ipv4/ip_input.c 
b/pfinet/linux-src/net/ipv4/ip_input.c
index 545f093..a6ff57c 100644
--- a/pfinet/linux-src/net/ipv4/ip_input.c
+++ b/pfinet/linux-src/net/ipv4/ip_input.c
@@ -548,4 +548,3 @@ drop:
         kfree_skb(skb);
         return(0);
 }
-
diff --git a/pfinet/linux-src/net/ipv4/ip_masq_quake.c 
b/pfinet/linux-src/net/ipv4/ip_masq_quake.c
index 646348d..b981964 100644
--- a/pfinet/linux-src/net/ipv4/ip_masq_quake.c
+++ b/pfinet/linux-src/net/ipv4/ip_masq_quake.c
@@ -318,5 +318,3 @@ void cleanup_module(void)
 }
 
 #endif /* MODULE */
-
-
diff --git a/pfinet/linux-src/net/ipv4/ip_output.c 
b/pfinet/linux-src/net/ipv4/ip_output.c
index d85ba6b..f43f4ff 100644
--- a/pfinet/linux-src/net/ipv4/ip_output.c
+++ b/pfinet/linux-src/net/ipv4/ip_output.c
@@ -989,4 +989,3 @@ __initfunc(void ip_init(void))
 #endif
 #endif 
 }
-
diff --git a/pfinet/linux-src/net/ipv4/timer.c 
b/pfinet/linux-src/net/ipv4/timer.c
index 3821a7c..3687ec3 100644
--- a/pfinet/linux-src/net/ipv4/timer.c
+++ b/pfinet/linux-src/net/ipv4/timer.c
@@ -124,4 +124,3 @@ void net_timer (unsigned long data)
                        break;
        }
 }
-
diff --git a/pfinet/linux-src/net/ipv4/utils.c 
b/pfinet/linux-src/net/ipv4/utils.c
index ce74ade..fe10838 100644
--- a/pfinet/linux-src/net/ipv4/utils.c
+++ b/pfinet/linux-src/net/ipv4/utils.c
@@ -88,4 +88,3 @@ __u32 in_aton(const char *str)
        }
        return(htonl(l));
 }
-
diff --git a/pfinet/linux-src/net/ipv6/exthdrs.c 
b/pfinet/linux-src/net/ipv6/exthdrs.c
index a3d3dfe..43ce881 100644
--- a/pfinet/linux-src/net/ipv6/exthdrs.c
+++ b/pfinet/linux-src/net/ipv6/exthdrs.c
@@ -768,4 +768,3 @@ u8 *ipv6_skip_exthdr(struct ipv6_opt_hdr *hdr, u8 
*nexthdrp, int len)
        *nexthdrp = nexthdr;
        return (u8*)hdr;
 }
-
diff --git a/pfinet/linux-src/net/ipv6/ip6_fib.c 
b/pfinet/linux-src/net/ipv6/ip6_fib.c
index 9468c02..670860b 100644
--- a/pfinet/linux-src/net/ipv6/ip6_fib.c
+++ b/pfinet/linux-src/net/ipv6/ip6_fib.c
@@ -1201,5 +1201,3 @@ void fib6_gc_cleanup(void)
        del_timer(&ip6_fib_timer);
 }
 #endif
-
-
diff --git a/pfinet/loopback.c b/pfinet/loopback.c
index 068cf3c..e15e426 100644
--- a/pfinet/loopback.c
+++ b/pfinet/loopback.c
@@ -71,6 +71,13 @@ static int loopback_xmit(struct sk_buff *skb, struct device 
*dev)
 #ifndef LOOPBACK_MUST_CHECKSUM
        skb->ip_summed = CHECKSUM_UNNECESSARY;
 #endif
+
+       /*
+        *      Calling netif_rx() requires locking net_bh_lock, which
+        *      has already been done since this function is called by
+        *      the net_bh worker thread.
+        */
+
        netif_rx(skb);
 
        stats->rx_bytes+=skb->len;
diff --git a/pfinet/main.c b/pfinet/main.c
index c952719..dce1600 100644
--- a/pfinet/main.c
+++ b/pfinet/main.c
@@ -77,11 +77,11 @@ pfinet_demuxer (mach_msg_header_t *inp,
                mach_msg_header_t *outp)
 {
   struct port_info *pi;
-  extern int io_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int socket_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int startup_notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int pfinet_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int iioctl_server (mach_msg_header_t *, mach_msg_header_t *);
+  mig_routine_t io_server_routine (mach_msg_header_t *);
+  mig_routine_t socket_server_routine (mach_msg_header_t *);
+  mig_routine_t pfinet_server_routine (mach_msg_header_t *);
+  mig_routine_t iioctl_server_routine (mach_msg_header_t *);
+  mig_routine_t startup_notify_server_routine (mach_msg_header_t *);
 
   /* We have several classes in one bucket, which need to be demuxed
      differently.  */
@@ -90,20 +90,38 @@ pfinet_demuxer (mach_msg_header_t *inp,
   if (pi)
     {
       ports_port_deref (pi);
-      
-      return (io_server (inp, outp)
-             || socket_server (inp, outp)
-             || pfinet_server (inp, outp)
-             || iioctl_server (inp, outp)
-             || trivfs_demuxer (inp, outp)
-             || startup_notify_server (inp, outp));
+
+      mig_routine_t routine;
+      if ((routine = io_server_routine (inp)) ||
+          (routine = socket_server_routine (inp)) ||
+          (routine = pfinet_server_routine (inp)) ||
+          (routine = iioctl_server_routine (inp)) ||
+          (routine = NULL, trivfs_demuxer (inp, outp)) ||
+          (routine = startup_notify_server_routine (inp)))
+        {
+          if (routine)
+            (*routine) (inp, outp);
+          return TRUE;
+        }
+      else
+        return FALSE;
     }
   else
-    return (socket_server (inp, outp)
-           || pfinet_server (inp, outp)
-           || iioctl_server (inp, outp)
-           || trivfs_demuxer (inp, outp)
-           || startup_notify_server (inp, outp));
+    {
+      mig_routine_t routine;
+      if ((routine = socket_server_routine (inp)) ||
+          (routine = pfinet_server_routine (inp)) ||
+          (routine = iioctl_server_routine (inp)) ||
+          (routine = NULL, trivfs_demuxer (inp, outp)) ||
+          (routine = startup_notify_server_routine (inp)))
+        {
+          if (routine)
+            (*routine) (inp, outp);
+          return TRUE;
+        }
+      else
+        return FALSE;
+    }
 }
 
 /* The system is going down; destroy all the extant port rights.  That
diff --git a/pfinet/sched.c b/pfinet/sched.c
index 8992774..af03ab4 100644
--- a/pfinet/sched.c
+++ b/pfinet/sched.c
@@ -26,6 +26,7 @@
 pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
 pthread_mutex_t net_bh_lock = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t net_bh_wakeup = PTHREAD_COND_INITIALIZER;
+int net_bh_raised = 0;
 
 struct task_struct current_contents; /* zeros are right default values */
 
@@ -61,7 +62,11 @@ net_bh_worker (void *arg)
   pthread_mutex_lock (&net_bh_lock);
   while (1)
     {
-      pthread_cond_wait (&net_bh_wakeup, &net_bh_lock);
+      while (!net_bh_raised)
+        pthread_cond_wait (&net_bh_wakeup, &net_bh_lock);
+
+      net_bh_raised = 0;
+
       pthread_mutex_lock (&global_lock);
       net_bh ();
       pthread_mutex_unlock (&global_lock);
diff --git a/pflocal/pflocal.c b/pflocal/pflocal.c
index 7a4e8d9..d51f721 100644
--- a/pflocal/pflocal.c
+++ b/pflocal/pflocal.c
@@ -51,8 +51,18 @@ int trivfs_cntl_nportclasses = 1;
 static int
 pf_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 {
-  extern int socket_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
-  return socket_server (inp, outp) || trivfs_demuxer (inp, outp);
+  mig_routine_t socket_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = socket_server_routine (inp)) ||
+      (routine = NULL, trivfs_demuxer (inp, outp)))
+    {
+      if (routine)
+        (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
 
 
diff --git a/pflocal/sserver.c b/pflocal/sserver.c
index 9de0aa5..4ce26b1 100644
--- a/pflocal/sserver.c
+++ b/pflocal/sserver.c
@@ -1,6 +1,6 @@
 /* Server for socket ops
 
-   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 2013 Free Software Foundation, Inc.
 
    Written by Miles Bader <address@hidden>
 
@@ -36,13 +36,22 @@ static pthread_spinlock_t sock_server_active_lock = 
PTHREAD_SPINLOCK_INITIALIZER
 static int
 sock_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 {
-  extern int socket_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
-  extern int io_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
-  return
-    socket_server (inp, outp)
-      || io_server (inp, outp)
-      || ports_interrupt_server (inp, outp)
-      || ports_notify_server (inp, outp);
+  mig_routine_t io_server_routine (mach_msg_header_t *);
+  mig_routine_t socket_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = io_server_routine (inp)) ||
+      (routine = socket_server_routine (inp)) ||
+      (routine = ports_interrupt_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)))
+    {
+      (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
 
 /* Handle socket requests while there are sockets around.  */
diff --git a/proc/host.c b/proc/host.c
index 488863b..6841273 100644
--- a/proc/host.c
+++ b/proc/host.c
@@ -70,8 +70,8 @@ S_proc_getprivports (struct proc *p,
   if (! check_uid (p, 0))
     return EPERM;
 
-  *hostpriv = master_host_port;
-  *devpriv = master_device_port;
+  *hostpriv = _hurd_host_priv;
+  *devpriv = _hurd_device_master;
   return 0;
 }
 
@@ -419,7 +419,7 @@ S_proc_register_version (pstruct_t server,
 
   /* No need to check SERVER here; we don't use it. */
 
-  if (credential != master_host_port)
+  if (credential != _hurd_host_priv)
     /* Must be privileged to register for uname. */
     return EPERM;
 
diff --git a/proc/main.c b/proc/main.c
index 73abbc0..5d6dc21 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -38,18 +38,24 @@ int
 message_demuxer (mach_msg_header_t *inp,
                 mach_msg_header_t *outp)
 {
-  extern int process_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int proc_exc_server (mach_msg_header_t *, mach_msg_header_t *);
-  int status;
-
-  pthread_mutex_lock (&global_lock);
-  status = (process_server (inp, outp)
-           || notify_server (inp, outp)
-           || ports_interrupt_server (inp, outp)
-           || proc_exc_server (inp, outp));
-  pthread_mutex_unlock (&global_lock);
-  return status;
+  mig_routine_t process_server_routine (mach_msg_header_t *);
+  mig_routine_t notify_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+  mig_routine_t proc_exc_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = process_server_routine (inp)) ||
+      (routine = notify_server_routine (inp)) ||
+      (routine = ports_interrupt_server_routine (inp)) ||
+      (routine = proc_exc_server_routine (inp)))
+    {
+      pthread_mutex_lock (&global_lock);
+      (*routine) (inp, outp);
+      pthread_mutex_unlock (&global_lock);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
 
 pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -84,7 +90,7 @@ main (int argc, char **argv, char **envp)
   /* Create the initial proc object for init (PID 1).  */
   startup_proc = create_startup_proc ();
 
-  /* Create our own proc object (we are PID 0).  */
+  /* Create our own proc object.  */
   self_proc = allocate_proc (mach_task_self ());
   assert (self_proc);
 
@@ -92,7 +98,7 @@ main (int argc, char **argv, char **envp)
 
   startup_port = ports_get_send_right (startup_proc);
   err = startup_procinit (boot, startup_port, &startup_proc->p_task,
-                         &authserver, &master_host_port, &master_device_port);
+                         &authserver, &_hurd_host_priv, &_hurd_device_master);
   assert_perror (err);
   mach_port_deallocate (mach_task_self (), startup_port);
 
@@ -111,7 +117,7 @@ main (int argc, char **argv, char **envp)
      important. */
   err = thread_get_assignment (mach_thread_self (), &pset);
   assert_perror (err);
-  err = host_processor_set_priv (master_host_port, pset, &psetcntl);
+  err = host_processor_set_priv (_hurd_host_priv, pset, &psetcntl);
   assert_perror (err);
   thread_max_priority (mach_thread_self (), psetcntl, 0);
   assert_perror (err);
@@ -126,7 +132,7 @@ main (int argc, char **argv, char **envp)
        to panic or something.  */
     mach_port_t cons;
     error_t err;
-    err = device_open (master_device_port, D_READ|D_WRITE, "console", &cons);
+    err = device_open (_hurd_device_master, D_READ|D_WRITE, "console", &cons);
     assert_perror (err);
     stdin = mach_open_devstream (cons, "r");
     stdout = stderr = mach_open_devstream (cons, "w");
diff --git a/proc/mgt.c b/proc/mgt.c
index d7ad296..602ba84 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -458,6 +458,8 @@ S_proc_exception_raise (mach_port_t excport,
       ports_port_deref (e);
       mach_port_deallocate (mach_task_self (), thread);
       mach_port_deallocate (mach_task_self (), task);
+      if (err)
+       return err;
       return MIG_NO_REPLY;
 
     default:
@@ -514,6 +516,20 @@ S_proc_exception_raise (mach_port_t excport,
 
 }
 
+/* This function is used as callback in S_proc_getallpids.  */
+static void
+count_up (struct proc *p, void *counter)
+{
+  ++*(int *)counter;
+}
+
+/* This function is used as callback in S_proc_getallpids.  */
+static void
+store_pid (struct proc *p, void *loc)
+{
+  *(*(pid_t **)loc)++ = p->p_pid;
+}
+
 /* Implement proc_getallpids as described in <hurd/process.defs>. */
 kern_return_t
 S_proc_getallpids (struct proc *p,
@@ -523,15 +539,6 @@ S_proc_getallpids (struct proc *p,
   int nprocs;
   pid_t *loc;
 
-  void count_up (struct proc *p, void *counter)
-    {
-      ++*(int *)counter;
-    }
-  void store_pid (struct proc *p, void *loc)
-    {
-      *(*(pid_t **)loc)++ = p->p_pid;
-    }
-
   /* No need to check P here; we don't use it. */
 
   add_tasks (0);
@@ -821,7 +828,7 @@ add_tasks (task_t task)
 
       if (!foundp)
        {
-         host_processor_set_priv (master_host_port, psets[i], &psetpriv);
+         host_processor_set_priv (_hurd_host_priv, psets[i], &psetpriv);
          processor_set_tasks (psetpriv, &tasks, &ntasks);
          for (j = 0; j < ntasks; j++)
            {
diff --git a/proc/msg.c b/proc/msg.c
index a6eca21..796cae3 100644
--- a/proc/msg.c
+++ b/proc/msg.c
@@ -40,7 +40,7 @@ static void *
 tickle_init (void *initport)
 {
   startup_essential_task ((mach_port_t) initport, mach_task_self (),
-                         MACH_PORT_NULL, "proc", master_host_port);
+                         MACH_PORT_NULL, "proc", _hurd_host_priv);
   return NULL;
 }
 
diff --git a/proc/pgrp.c b/proc/pgrp.c
index d4ea9ee..a828e17 100644
--- a/proc/pgrp.c
+++ b/proc/pgrp.c
@@ -341,8 +341,14 @@ S_proc_setpgrp (struct proc *callerp,
 
   if (p->p_pgrp != pg)
     {
+      /* If we have to create a new pgrp, we have to do this before
+        leaving the current one.  p->p_pgrp is deallocated if p is
+        the last process in that group.  Likewise, if p->p_pgrp was
+        the last group in p->p_pgrp->pg_session, the session is
+        deallocated.  */
+      struct pgrp *new = pg ? pg : new_pgrp (pgid, p->p_pgrp->pg_session);
       leave_pgrp (p);
-      p->p_pgrp = pg ? pg : new_pgrp (pgid, p->p_pgrp->pg_session);
+      p->p_pgrp = new;
       join_pgrp (p);
     }
   else
diff --git a/proc/proc.h b/proc/proc.h
index 80f8397..12f56da 100644
--- a/proc/proc.h
+++ b/proc/proc.h
@@ -133,7 +133,7 @@ struct exc
 };
 
 mach_port_t authserver;
-struct proc *self_proc;                /* process 0 (us) */
+struct proc *self_proc;                /* process HURD_PID_PROC (us) */
 struct proc *startup_proc;     /* process 1 (init) */
 
 struct port_bucket *proc_bucket;
@@ -141,9 +141,6 @@ struct port_class *proc_class;
 struct port_class *generic_port_class;
 struct port_class *exc_class;
 
-mach_port_t master_host_port;
-mach_port_t master_device_port;
-
 mach_port_t generic_port;      /* messages not related to a specific proc */
 
 pthread_mutex_t global_lock;
@@ -161,12 +158,10 @@ int check_uid (struct proc *, uid_t);
 int check_owner (struct proc *, struct proc *);
 void addalltasks (void);
 void prociterate (void (*)(struct proc *, void *), void *);
-void count_up (void *);
-void store_pid (void *);
 void free_process (struct proc *);
 void panic (char *);
 int valid_task (task_t);
-int genpid ();
+int genpid (void);
 void abort_getmsgport (struct proc *);
 int zombie_check_pid (pid_t);
 void check_message_dying (struct proc *, struct proc *);
diff --git a/proc/proc_exc.defs b/proc/proc_exc.defs
index 283de47..e9c58f1 100644
--- a/proc/proc_exc.defs
+++ b/proc/proc_exc.defs
@@ -43,6 +43,3 @@ routine proc_exception_raise (
        exception: integer_t;
        code: integer_t;
        subcode: integer_t);
-
-
-
diff --git a/release/README b/release/README
index fcb6a26..016e071 100644
--- a/release/README
+++ b/release/README
@@ -9,5 +9,3 @@ into the root of binary distributions.
 
 Use `make install-tools tool-root=FOO' to install the tools that are
 used to build binary distributions.
-
-
diff --git a/release/SOURCES.0.2 b/release/SOURCES.0.2
index 4f50de8..3fc6873 100644
--- a/release/SOURCES.0.2
+++ b/release/SOURCES.0.2
@@ -106,5 +106,3 @@ texinfo (3.9)
 textutils (1.22)
 time (1.7)
 wdiff (0.5)
-
-
diff --git a/release/dist-README b/release/dist-README
index afad66c..20f1627 100644
--- a/release/dist-README
+++ b/release/dist-README
@@ -34,6 +34,3 @@ to the hurd mailing lists.
 
 The GNU system is free software.  See the files /share/misc/COPYING
 and /share/misc/COPYING.LIB.
-
-
-
diff --git a/release/menu.lst b/release/menu.lst
index 00807de..cce718c 100644
--- a/release/menu.lst
+++ b/release/menu.lst
@@ -47,4 +47,3 @@ install= (fd0)+1 (hd0) (hd0,a)/boot/grub/stage2 0x8000 p
 # Entry 5:
 title=  Reinstall grub from hard disk to itself
 install= (hd0)/boot/grub/stage1 (hd0) (hd0,a)/boot/grub/stage2 0x8000 p
-
diff --git a/term/hurdio.c b/term/hurdio.c
index 357ab38..b34854c 100644
--- a/term/hurdio.c
+++ b/term/hurdio.c
@@ -585,10 +585,15 @@ hurdio_mdmctl (int how, int bits)
            {
              error_t err = tioctl_tiocmodg (ioport, &oldbits);
              if (err && (err == EMIG_BAD_ID || err == EOPNOTSUPP))
-               tioc_caps &= ~TIOC_CAP_MODG;
+               {
+                 tioc_caps &= ~TIOC_CAP_MODG;
+                 return EOPNOTSUPP;
+               }
              else if (err)
                return err;
            }
+         else
+           return EOPNOTSUPP;
        }
 
       if (how == MDMCTL_BIS)
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 8373be3..0e0b618 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -1,5 +1,5 @@
 /* fakeroot -- a translator for faking actions that aren't really permitted
-   Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2008, 2013 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -41,6 +41,7 @@ static auth_t fakeroot_auth_port;
 
 struct netnode
 {
+  struct node *np;             /* our node */
   hurd_ihash_locp_t idport_locp;/* easy removal pointer in idport ihash */
   mach_port_t idport;          /* port from io_identity */
   int openmodes;               /* O_READ | O_WRITE | O_EXEC */
@@ -60,7 +61,8 @@ struct hurd_ihash idport_ihash
   = HURD_IHASH_INITIALIZER (offsetof (struct netnode, idport_locp));
 
 
-/* Make a new virtual node.  Always consumes the ports.  */
+/* Make a new virtual node.  Always consumes the ports.  If
+   successful, NP will be locked.  */
 static error_t
 new_node (file_t file, mach_port_t idport, int locked, int openmodes,
          struct node **np)
@@ -93,28 +95,31 @@ new_node (file_t file, mach_port_t idport, int locked, int 
openmodes,
          return err;
        }
     }
-  *np = netfs_make_node (nn);
+
+  if (!locked)
+    pthread_mutex_lock (&idport_ihash_lock);
+  err = hurd_ihash_add (&idport_ihash, nn->idport, nn);
+  if (err)
+    goto lose;
+
+  *np = nn->np = netfs_make_node (nn);
   if (*np == 0)
     {
-      if (locked)
-       pthread_mutex_unlock (&idport_ihash_lock);
       err = ENOMEM;
+      goto lose_hash;
     }
-  else
-    {
-      if (!locked)
-       pthread_mutex_lock (&idport_ihash_lock);
-      err = hurd_ihash_add (&idport_ihash, nn->idport, *np);
-      if (!err)
-       netfs_nref (*np);       /* Return a reference to the caller.  */
-      pthread_mutex_unlock (&idport_ihash_lock);
-    }
-  if (err)
-    {
-      mach_port_deallocate (mach_task_self (), nn->idport);
-      mach_port_deallocate (mach_task_self (), file);
-      free (nn);
-    }
+
+  pthread_mutex_lock (&(*np)->lock);
+  pthread_mutex_unlock (&idport_ihash_lock);
+  return 0;
+
+ lose_hash:
+  hurd_ihash_locp_remove (&idport_ihash, nn->idport_locp);
+ lose:
+  pthread_mutex_unlock (&idport_ihash_lock);
+  mach_port_deallocate (mach_task_self (), nn->idport);
+  mach_port_deallocate (mach_task_self (), file);
+  free (nn);
   return err;
 }
 
@@ -122,6 +127,32 @@ new_node (file_t file, mach_port_t idport, int locked, int 
openmodes,
 void
 netfs_node_norefs (struct node *np)
 {
+  assert (np->nn->np == np);
+  mach_port_deallocate (mach_task_self (), np->nn->file);
+  mach_port_deallocate (mach_task_self (), np->nn->idport);
+  free (np->nn);
+  free (np);
+}
+
+/* This is the cleanup function we install in netfs_protid_class.  If
+   the associated nodes reference count would also drop to zero, and
+   the node has no faked attributes, we destroy it as well.  */
+static void
+fakeroot_netfs_release_protid (void *cookie)
+{
+  struct node *np = ((struct protid *) cookie)->po->np;
+  assert (np->nn->np == np);
+
+  pthread_mutex_lock (&idport_ihash_lock);
+  pthread_mutex_lock (&np->lock);
+
+  assert ((np->nn->faked & FAKE_REFERENCE) == 0);
+
+  /* Check if someone else reacquired a reference to the node besides
+     ours that is about to be dropped.  */
+  if (np->references > 1)
+    goto out;
+
   if (np->nn->faked != 0
       && netfs_validate_stat (np, 0) == 0 && np->nn_stat.st_nlink > 0)
     {
@@ -133,30 +164,45 @@ netfs_node_norefs (struct node *np)
         until this fakeroot filesystem dies.  One easy solution
         would be to scan nodes with references=1 for st_nlink=0
         at some convenient time, periodically or in syncfs.  */
-      if ((np->nn->faked & FAKE_REFERENCE) == 0)
-       {
-         np->nn->faked |= FAKE_REFERENCE;
-         ++np->references;
-       }
-      pthread_mutex_unlock (&np->lock);
-      return;
+
+      /* Keep a fake reference.  */
+      netfs_nref (np);
+
+      /* Set the FAKE_REFERENCE flag so that we can properly
+        account for that fake reference.  */
+      np->nn->faked |= FAKE_REFERENCE;
+
+      /* Clear the lock box as if the file was closed.  */
+      fshelp_lock_init (&np->userlock);
+
+      /* We keep our node.  */
+      goto out;
     }
 
-  pthread_spin_unlock (&netfs_node_refcnt_lock); /* Avoid deadlock.  */
-  pthread_mutex_lock (&idport_ihash_lock);
-  pthread_spin_lock (&netfs_node_refcnt_lock);
-  /* Previous holder of this lock might have just got a reference.  */
-  if (np->references > 0)
+  hurd_ihash_locp_remove (&idport_ihash, np->nn->idport_locp);
+
+ out:
+  pthread_mutex_unlock (&np->lock);
+  netfs_release_protid (cookie);
+
+  int cports = ports_count_class (netfs_control_class);
+  int nports = ports_count_class (netfs_protid_class);
+  ports_enable_class (netfs_control_class);
+  ports_enable_class (netfs_protid_class);
+  if (cports == 0 && nports == 0)
     {
-      pthread_mutex_unlock (&idport_ihash_lock);
-      return;
+      /* The last client is gone.  Our job is done.  */
+      error_t err = netfs_shutdown (0);
+      if (! err)
+        exit (EXIT_SUCCESS);
+
+      /* If netfs_shutdown returns EBUSY, we lost a race against
+         fsys_goaway.  Hence we ignore this error.  */
+      if (err != EBUSY)
+        error (1, err, "netfs_shutdown");
     }
-  hurd_ihash_locp_remove (&idport_ihash, np->nn->idport_locp);
+
   pthread_mutex_unlock (&idport_ihash_lock);
-  mach_port_deallocate (mach_task_self (), np->nn->file);
-  mach_port_deallocate (mach_task_self (), np->nn->idport);
-  free (np->nn);
-  free (np);
 }
 
 /* Given an existing node, make sure it has NEWMODES in its openmodes.
@@ -235,7 +281,10 @@ netfs_S_dir_lookup (struct protid *diruser,
     return EOPNOTSUPP;
 
   dnp = diruser->po->np;
-  err = dir_lookup (dnp->nn->file, filename,
+
+  mach_port_t dir = dnp->nn->file;
+ redo_lookup:
+  err = dir_lookup (dir, filename,
                    flags & (O_NOLINK|O_RDWR|O_EXEC|O_CREAT|O_EXCL|O_NONBLOCK),
                    mode, do_retry, retry_name, &file);
   if (err)
@@ -252,25 +301,40 @@ netfs_S_dir_lookup (struct protid *diruser,
            mach_port_deallocate (mach_task_self (), file);
            err = auth_user_authenticate (fakeroot_auth_port, ref,
                                          MACH_MSG_TYPE_MAKE_SEND,
-                                         retry_port);
+                                         &dir);
          }
        mach_port_destroy (mach_task_self (), ref);
        if (err)
          return err;
       }
-      *do_retry = FS_RETRY_NORMAL;
-      /*FALLTHROUGH*/
+      filename = retry_name;
+      goto redo_lookup;
 
     case FS_RETRY_NORMAL:
+      if (retry_name[0] != '\0')
+       {
+         dir = file;
+         filename = retry_name;
+         goto redo_lookup;
+       }
+      break;
+
     case FS_RETRY_MAGICAL:
-    default:
       if (file == MACH_PORT_NULL)
        {
          *retry_port = MACH_PORT_NULL;
          *retry_port_type = MACH_MSG_TYPE_COPY_SEND;
          return 0;
        }
-      break;
+      /* Fallthrough.  */
+
+    default:
+      /* Invalid response to our dir_lookup request.  */
+      if (file != MACH_PORT_NULL)
+       mach_port_deallocate (mach_task_self (), file);
+      *retry_port = MACH_PORT_NULL;
+      *retry_port_type = MACH_MSG_TYPE_COPY_SEND;
+      return EOPNOTSUPP;
     }
 
   /* We have a new port to an underlying node.
@@ -279,51 +343,54 @@ netfs_S_dir_lookup (struct protid *diruser,
   np = 0;
   err = io_identity (file, &idport, &fsidport, &fileno);
   if (err)
-    mach_port_deallocate (mach_task_self (), file);
-  else
     {
-      mach_port_deallocate (mach_task_self (), fsidport);
-      if (fsidport == netfs_fsys_identity)
+      mach_port_deallocate (mach_task_self (), file);
+      return err;
+    }
+
+  mach_port_deallocate (mach_task_self (), fsidport);
+  pthread_mutex_lock (&idport_ihash_lock);
+  pthread_mutex_lock (&dnp->lock);
+  struct netnode *nn = hurd_ihash_find (&idport_ihash, idport);
+  if (nn != NULL)
+    {
+      assert (nn->np->nn == nn);
+      np = nn->np;
+      /* We already know about this node.  */
+      mach_port_deallocate (mach_task_self (), idport);
+
+      if (np == dnp)
        {
-         /* Talking to ourselves!  We just looked up one of our
-            own nodes.  Find the node and return it.  */
-         struct protid *cred
-           = ports_lookup_port (netfs_port_bucket, file,
-                                netfs_protid_class);
-         mach_port_deallocate (mach_task_self (), idport);
-         mach_port_deallocate (mach_task_self (), file);
-         if (cred == 0)
-           return EGRATUITOUS;
-         np = cred->po->np;
-         netfs_nref (np);
-         ports_port_deref (cred);
+         /* dnp is already locked.  */
        }
       else
        {
-         pthread_mutex_lock (&idport_ihash_lock);
-         np = hurd_ihash_find (&idport_ihash, idport);
-         if (np != 0)
-           {
-             /* We already know about this node.  */
-             mach_port_deallocate (mach_task_self (), idport);
-             pthread_mutex_lock (&np->lock);
-             err = check_openmodes (np->nn, (flags & (O_RDWR|O_EXEC)), file);
-             if (!err)
-               netfs_nref (np);
-             pthread_mutex_unlock (&np->lock);
-             pthread_mutex_unlock (&idport_ihash_lock);
-           }
-         else
-           err = new_node (file, idport, 1, flags, &np);
+         pthread_mutex_lock (&np->lock);
+         pthread_mutex_unlock (&dnp->lock);
        }
+
+      /* If the looked-up file carries a fake reference, we
+        use that and clear the FAKE_REFERENCE flag.  */
+      if (np->nn->faked & FAKE_REFERENCE)
+       np->nn->faked &= ~FAKE_REFERENCE;
+      else
+       netfs_nref (np);
+
+      err = check_openmodes (np->nn, (flags & (O_RDWR|O_EXEC)), file);
+      pthread_mutex_unlock (&idport_ihash_lock);
+    }
+  else
+    {
+      err = new_node (file, idport, 1, flags, &np);
+      pthread_mutex_unlock (&dnp->lock);
+      if (!err)
+       err = netfs_validate_stat (np, diruser->user);
     }
   if (err)
-    return err;
+    goto lose;
 
-  if (retry_name[0] == '\0' && *do_retry == FS_RETRY_NORMAL)
-    flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS|O_NONBLOCK);
-  else
-    flags = 0;
+  assert (retry_name[0] == '\0' && *do_retry == FS_RETRY_NORMAL);
+  flags &= ~(O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS|O_NONBLOCK);
 
   err = iohelp_dup_iouser (&user, diruser->user);
   if (!err)
@@ -337,13 +404,17 @@ netfs_S_dir_lookup (struct protid *diruser,
        }
       else
        {
+         err = netfs_attempt_chown (user, np, 0, 0);
+         assert_perror (err); /* Our netfs_attempt_chown cannot fail.  */
          *retry_port = ports_get_right (newpi);
          *retry_port_type = MACH_MSG_TYPE_MAKE_SEND;
          ports_port_deref (newpi);
        }
     }
 
-  netfs_nrele (np);
+ lose:
+  if (np != NULL)
+    netfs_nput (np);
   return err;
 }
 
@@ -597,9 +668,11 @@ netfs_attempt_mkfile (struct iouser *user, struct node 
*dir,
   file_t newfile;
   error_t err = dir_mkfile (dir->nn->file, O_RDWR|O_EXEC,
                            real_from_fake_mode (mode), &newfile);
-  pthread_mutex_unlock (&dir->lock);
   if (err == 0)
     err = new_node (newfile, MACH_PORT_NULL, 0, O_RDWR|O_EXEC, np);
+  if (err == 0)
+    pthread_mutex_unlock (&(*np)->lock);
+  pthread_mutex_unlock (&dir->lock);
   return err;
 }
 
@@ -777,6 +850,27 @@ netfs_S_io_map_cntl (struct protid *user,
   return err;
 }
 
+error_t
+netfs_S_io_identity (struct protid *user,
+                    mach_port_t *id,
+                    mach_msg_type_name_t *idtype,
+                    mach_port_t *fsys,
+                    mach_msg_type_name_t *fsystype,
+                    ino_t *fileno)
+{
+  error_t err;
+
+  if (!user)
+    return EOPNOTSUPP;
+
+  *idtype = *fsystype = MACH_MSG_TYPE_MOVE_SEND;
+
+  pthread_mutex_lock (&user->po->np->lock);
+  err = io_identity (user->po->np->nn->file, id, fsys, fileno);
+  pthread_mutex_unlock (&user->po->np->lock);
+  return err;
+}
+
 #define NETFS_S_SIMPLE(name)                   \
 error_t                                                \
 netfs_S_##name (struct protid *user)           \
@@ -834,21 +928,26 @@ int
 netfs_demuxer (mach_msg_header_t *inp,
               mach_msg_header_t *outp)
 {
-  int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *);
-  int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *);
-  int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *);
-  int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *);
-
-  if (netfs_io_server (inp, outp)
-      || netfs_fs_server (inp, outp)
-      || ports_notify_server (inp, outp)
-      || netfs_fsys_server (inp, outp)
+  mig_routine_t netfs_io_server_routine (mach_msg_header_t *);
+  mig_routine_t netfs_fs_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+  mig_routine_t netfs_fsys_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = netfs_io_server_routine (inp)) ||
+      (routine = netfs_fs_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)) ||
+      (routine = netfs_fsys_server_routine (inp)) ||
       /* XXX we should intercept interrupt_operation and do
         the ports_S_interrupt_operation work as well as
         sending an interrupt_operation to the underlying file.
        */
-      || ports_interrupt_server (inp, outp))
-    return 1;
+      (routine = ports_interrupt_server_routine (inp)))
+    {
+      (*routine) (inp, outp);
+      return TRUE;
+    }
   else
     {
       /* We didn't recognize the message ID, so pass the message through
@@ -905,6 +1004,9 @@ any user to open nodes regardless of permissions as is 
done for root." };
   task_get_bootstrap_port (mach_task_self (), &bootstrap);
   netfs_init ();
 
+  /* Install our own clean routine.  */
+  netfs_protid_class->clean_routine = fakeroot_netfs_release_protid;
+
   /* Get our underlying node (we presume it's a directory) and use
      that to make the root node of the filesystem.  */
   err = new_node (netfs_startup (bootstrap, O_READ), MACH_PORT_NULL, 0, O_READ,
@@ -919,6 +1021,7 @@ any user to open nodes regardless of permissions as is 
done for root." };
   netfs_root_node->nn_stat.st_mode &= ~(S_IPTRANS | S_IATRANS);
   netfs_root_node->nn_stat.st_mode |= S_IROOT;
   netfs_root_node->nn->faked |= FAKE_MODE;
+  pthread_mutex_unlock (&netfs_root_node->lock);
 
   netfs_server_loop ();                /* Never returns.  */
 
diff --git a/trans/mtab.c b/trans/mtab.c
index 250de7d..75ef1d3 100644
--- a/trans/mtab.c
+++ b/trans/mtab.c
@@ -1,6 +1,6 @@
 /* This is an mtab translator.
 
-   Copyright (C) 2013 Free Software Foundation, Inc.
+   Copyright (C) 2013,14 Free Software Foundation, Inc.
 
    Written by Justus Winter <address@hidden>
 
@@ -27,6 +27,7 @@
 #include <hurd/trivfs.h>
 #include <inttypes.h>
 #include <mntent.h>
+#include <pthread.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -39,6 +40,7 @@
 
 static char *target_path = NULL;
 static int insecure = 0;
+static int all_translators = 0;
 
 /* Our control port.  */
 struct trivfs_control *control;
@@ -47,6 +49,7 @@ struct trivfs_control *control;
    They keep track of the content and file position of the client.  */
 struct mtab
 {
+  pthread_mutex_t lock;
   char *contents;
   size_t contents_len;
   off_t offs;
@@ -58,6 +61,9 @@ static const struct argp_option options[] =
 {
   {"insecure", 'I', 0, 0,
    "Follow translators not bound to nodes owned by you or root"},
+  {"all-translators", 'A', 0, 0,
+   "List all translators, even those that are probably not "
+   "filesystem translators"},
   {}
 };
 
@@ -70,6 +76,10 @@ error_t parse_opt (int key, char *arg, struct argp_state 
*state)
       insecure = 1;
       break;
 
+    case 'A':
+      all_translators = 1;
+      break;
+
     case ARGP_KEY_ARG:
       target_path = realpath (arg, NULL);
       if (! target_path)
@@ -233,9 +243,13 @@ main (int argc, char *argv[])
        error (4, err, "trivfs_startup");
 
       /* Launch.  */
-      ports_manage_port_operations_one_thread (control->pi.bucket,
-                                              trivfs_demuxer,
-                                              0);
+      ports_manage_port_operations_multithread (control->pi.bucket,
+                                                trivfs_demuxer,
+                                                /* idle thread timeout */
+                                                30 * 1000,
+                                                /* idle server timeout */
+                                                0,
+                                                NULL);
     }
   else
     {
@@ -271,6 +285,32 @@ mtab_add_entry (struct mtab *mtab, const char *entry, 
size_t length)
   return 0;
 }
 
+/* Check whether the given NODE is a directory on a filesystem
+   translator.  */
+static boolean_t
+is_filesystem_translator (file_t node)
+{
+  error_t err;
+  char *data = NULL;
+  size_t datacnt = 0;
+  int amount;
+  err = dir_readdir (node, &data, &datacnt, 0, 1, 0, &amount);
+  if (data != NULL && datacnt > 0)
+    vm_deallocate (mach_task_self (), (vm_address_t) data, datacnt);
+
+  /* Filesystem translators return either no error, or, if NODE has
+     not been looked up with O_READ, EBADF to dir_readdir
+     requests.  */
+  switch (err)
+    {
+    case 0:
+    case EBADF:
+      return TRUE;
+    default:
+      return FALSE;
+    }
+}
+
 /* Populates the given MTAB object with the information for PATH.  If
    INSECURE is given, also follow translators bound to nodes not owned
    by root or the current user.  */
@@ -282,7 +322,6 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
 
   /* These resources are freed in the epilogue.         */
   file_t node = MACH_PORT_NULL;
-  fsys_t fsys = MACH_PORT_NULL;
   char *argz = NULL;
   size_t argz_len = 0;
   char **argv = NULL;
@@ -295,16 +334,16 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
   char *children = NULL;
   size_t children_len = 0;
 
-  /* Get the underlying node.  */
-  node = file_name_lookup (path, O_NOTRANS, 0666);
-  if (node == MACH_PORT_NULL)
-    {
-      err = errno;
-      goto errout;
-    }
-
   if (! insecure)
     {
+      /* Get the underlying node.  */
+      node = file_name_lookup (path, O_NOTRANS, 0666);
+      if (node == MACH_PORT_NULL)
+        {
+          err = errno;
+          goto errout;
+        }
+
       /* Check who owns the node the translator is bound to.  */
       io_statbuf_t st;
       err = io_stat (node, &st);
@@ -316,28 +355,11 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
          err = EPERM;
          goto errout;
        }
-    }
-
-  err = file_get_translator_cntl (node, &fsys);
-  if (err == EPERM)
-    /* If we do not have permission to do that, it cannot be a node
-       bound to our control port, so ignore this error.         */
-    err = 0;
-
-  if (err == ENXIO && strcmp (path, "/") == 0)
-    /* The root translator fails differently, but this can't be bound
-       to our control port either, so ignore this error.  */
-    err = 0;
 
-  if (err)
-    return err;
-
-  if (control && control->pi.port_right == fsys)
-    /* This node is bound to our control port, ignore it.  */
-    goto errout;
+      mach_port_deallocate (mach_task_self (), node);
+    }
 
-  /* Re-do the lookup without O_NOTRANS to get the root node.  */
-  mach_port_deallocate (mach_task_self (), node);
+  /* (Re-)do the lookup without O_NOTRANS to get the root node.  */
   node = file_name_lookup (path, 0, 0666);
   if (node == MACH_PORT_NULL)
     {
@@ -345,6 +367,12 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
       goto errout;
     }
 
+  if (! (all_translators || is_filesystem_translator (node)))
+    {
+      err = 0;
+      goto errout;
+    }
+
   /* Query its options.         */
   err = file_get_fs_options (node, &argz, &argz_len);
   if (err)
@@ -461,9 +489,6 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
   if (node != MACH_PORT_NULL)
     mach_port_deallocate (mach_task_self (), node);
 
-  if (fsys != MACH_PORT_NULL)
-    mach_port_deallocate (mach_task_self (), fsys);
-
   if (argz)
     vm_deallocate (mach_task_self (), (vm_address_t) argz, argz_len);
 
@@ -590,18 +615,44 @@ open_hook (struct trivfs_peropen *peropen)
   peropen->hook = mtab;
 
   /* Initialize the fields.  */
+  pthread_mutex_init (&mtab->lock, NULL);
   mtab->offs = 0;
   mtab->contents = NULL;
   mtab->contents_len = 0;
 
-  return mtab_populate (mtab, target_path, insecure);
+  /* The mtab object is initialized, but not yet populated.  We delay
+     that until that data is really needed.  This avoids the following
+     problems:
+
+     Suppose you have
+
+     settrans -ac /foo /hurd/mtab /
+
+     If you now access /foo, the mtab translator will walk the tree of
+     all active translators starting from /.  If it visits /foo, it
+     will talk to itself.  Previously the translator migitated this by
+     comparing the control port of the translator with its own.  This
+     does not work if you got two mtab translators like this:
+
+     settrans -ac /foo /hurd/mtab /
+     settrans -ac /bar /hurd/mtab /
+
+     With a single-threaded mtab server this results in a dead-lock,
+     with a multi-threaded server this will create more and more
+     threads.
+
+     Delaying the data generation until it is really needed cleanly
+     avoids these kind of problems.  */
+  return 0;
 }
 
 static void
 close_hook (struct trivfs_peropen *peropen)
 {
-  free (((struct mtab *) peropen->hook)->contents);
-  free (peropen->hook);
+  struct mtab *op = peropen->hook;
+  pthread_mutex_destroy (&op->lock);
+  free (op->contents);
+  free (op);
 }
 
 /* Read data from an IO object.         If offset is -1, read from the object
@@ -613,6 +664,7 @@ trivfs_S_io_read (struct trivfs_protid *cred,
                  char **data, mach_msg_type_number_t *data_len,
                  loff_t offs, mach_msg_type_number_t amount)
 {
+  error_t err = 0;
   struct mtab *op;
 
   /* Deny access if they have bad credentials. */
@@ -624,6 +676,15 @@ trivfs_S_io_read (struct trivfs_protid *cred,
 
   /* Get the offset.  */
   op = cred->po->hook;
+  pthread_mutex_lock (&op->lock);
+
+  if (op->contents == NULL)
+    {
+      err = mtab_populate (op, target_path, insecure);
+      if (err)
+       goto out;
+    }
+
   if (offs == -1)
     offs = op->offs;
 
@@ -640,7 +701,10 @@ trivfs_S_io_read (struct trivfs_protid *cred,
        {
          *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
          if (*data == MAP_FAILED)
-           return ENOMEM;
+           {
+             err = ENOMEM;
+             goto out;
+           }
        }
 
       /* Copy the constant data into the buffer.  */
@@ -651,7 +715,9 @@ trivfs_S_io_read (struct trivfs_protid *cred,
     }
 
   *data_len = amount;
-  return 0;
+ out:
+  pthread_mutex_unlock (&op->lock);
+  return err;
 }
 
 
@@ -661,10 +727,19 @@ 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)
 {
+  error_t err = 0;
   if (! cred)
     return EOPNOTSUPP;
 
   struct mtab *op = cred->po->hook;
+  pthread_mutex_lock (&op->lock);
+
+  if (op->contents == NULL)
+    {
+      err = mtab_populate (op, target_path, insecure);
+      if (err)
+       goto out;
+    }
 
   switch (whence)
     {
@@ -681,10 +756,12 @@ trivfs_S_io_seek (struct trivfs_protid *cred,
          break;
        }
     default:
-      return EINVAL;
+      err = EINVAL;
     }
 
-  return 0;
+ out:
+  pthread_mutex_unlock (&op->lock);
+  return err;
 }
 
 /* If this variable is set, it is called every time a new peropen
@@ -703,6 +780,7 @@ trivfs_S_io_readable (struct trivfs_protid *cred,
                      mach_port_t reply, mach_msg_type_name_t replytype,
                      mach_msg_type_number_t *amount)
 {
+  error_t err = 0;
   if (!cred)
     return EOPNOTSUPP;
 
@@ -710,9 +788,19 @@ trivfs_S_io_readable (struct trivfs_protid *cred,
     return EINVAL;
 
   struct mtab *op = cred->po->hook;
+  pthread_mutex_lock (&op->lock);
+
+  if (op->contents == NULL)
+    {
+      error_t err = mtab_populate (op, target_path, insecure);
+      if (err)
+       goto out;
+    }
 
   *amount = op->contents_len - op->offs;
-  return 0;
+ out:
+  pthread_mutex_unlock (&op->lock);
+  return err;
 }
 
 /* SELECT_TYPE is the bitwise OR of SELECT_READ, SELECT_WRITE, and SELECT_URG.
diff --git a/usermux/node.c b/usermux/node.c
index 324b85b..2341714 100644
--- a/usermux/node.c
+++ b/usermux/node.c
@@ -90,7 +90,7 @@ netfs_attempt_utimes (struct iouser *cred, struct node *node,
       else
        flags |= TOUCH_ATIME;
 
-      fshelp_touch (&node->nn_stat, TOUCH_CTIME, usermux_maptime);
+      fshelp_touch (&node->nn_stat, flags, usermux_maptime);
     }
   return err;
 }
diff --git a/utils/Makefile b/utils/Makefile
index 46abf2a..5ebb231 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -54,6 +54,7 @@ login addauth setauth: nonsugid.o
 addauth rmauth setauth unsu: frobauth.o
 rmauth setauth unsu: frobauth-mod.o
 ps w: psout.o ../libps/libps.a ../libihash/libihash.a
+portinfo: ../libps/libps.a
 
 storeinfo storecat storeread: ../libstore/libstore.a
 ftpcp ftpdir: ../libftpconn/libftpconn.a
diff --git a/utils/fakeauth.c b/utils/fakeauth.c
index 154bf8e..2c72c89 100644
--- a/utils/fakeauth.c
+++ b/utils/fakeauth.c
@@ -302,11 +302,20 @@ S_interrupt_operation (mach_port_t port, 
mach_port_seqno_t seqno)
 static int
 auth_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 {
-  extern int auth_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
-  extern int interrupt_server (mach_msg_header_t *inp, mach_msg_header_t *);
-  return (auth_server (inp, outp) ||
-         interrupt_server (inp, outp) ||
-         ports_notify_server (inp, outp));
+  mig_routine_t auth_server_routine (mach_msg_header_t *);
+  mig_routine_t interrupt_server_routine (mach_msg_header_t *);
+  mig_routine_t ports_notify_server_routine (mach_msg_header_t *);
+
+  mig_routine_t routine;
+  if ((routine = auth_server_routine (inp)) ||
+      (routine = interrupt_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)))
+    {
+      (*routine) (inp, outp);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
 
 
diff --git a/utils/frobauth.c b/utils/frobauth.c
index ccb7c3b..44690d8 100644
--- a/utils/frobauth.c
+++ b/utils/frobauth.c
@@ -209,7 +209,7 @@ ea_parse_opt (int key, char *arg, struct argp_state *state)
 static error_t
 posix_parse_opt (int key, char *arg, struct argp_state *state)
 {
-  struct frobauth_argp_state *fs = state->hook;
+  struct frobauth_argp_state *fs;
 
   switch (key)
     {
@@ -233,7 +233,7 @@ posix_parse_opt (int key, char *arg, struct argp_state 
*state)
 static error_t
 no_ugids_parse_opt (int key, char *arg, struct argp_state *state)
 {
-  struct frobauth_argp_state *fs = state->hook;
+  struct frobauth_argp_state *fs;
 
   switch (key)
     {
diff --git a/utils/mount.c b/utils/mount.c
index 04519da..df77c66 100644
--- a/utils/mount.c
+++ b/utils/mount.c
@@ -1,6 +1,6 @@
 /* Roughly Unix/Linux-compatible `mount' frontend for Hurd translators.
 
-   Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004, 2013 Free Software Foundation, Inc.
 
    This file is part of the GNU Hurd.
 
@@ -353,7 +353,10 @@ do_mount (struct fs *fs, int remount)
             }
           else
             {
-              fs->mntent.mnt_type = strdup (type);
+             if (strcmp (type, "vfat") == 0)
+               fs->mntent.mnt_type = strdup ("fat");
+             else
+               fs->mntent.mnt_type = strdup (type);
               if (! fs->mntent.mnt_type)
                 error (3, ENOMEM, "failed to allocate memory");
             }
diff --git a/utils/portinfo.c b/utils/portinfo.c
index e78c77d..4c40352 100644
--- a/utils/portinfo.c
+++ b/utils/portinfo.c
@@ -1,6 +1,6 @@
 /* Print information about a task's ports
 
-   Copyright (C) 1996,97,98,99, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996,97,98,99, 2000,13 Free Software Foundation, Inc.
 
    Written by Miles Bader <address@hidden>
 
@@ -31,6 +31,8 @@
 
 #include <hurd.h>
 #include <hurd/process.h>
+#include <ps.h>
+#include <sys/mman.h>
 
 #include <portinfo.h>
 #include <portxlate.h>
@@ -63,8 +65,8 @@ static const struct argp_option options[] = {
 #endif
   {"no-translation-errors", 'E', 0, 0,
      "Don't display an error if a specified port can't be translated" },
-#if 0
   {"search",    'a', 0, 0,  "Search all processes for the given ports"},
+#if 0
   {"target-receive",  'R', 0, 0,
      "Only show ports that translate into receive rights"},
   {"target-send",     'S', 0, 0,
@@ -109,6 +111,122 @@ parse_task (char *arg)
   return task;
 }
 
+/* Functions searching for local ports in all processes.  */
+
+/* Locates the port NAME from TASK in any other process and prints the
+   mappings.  */
+error_t
+search_for_port (task_t task, mach_port_t name, unsigned show)
+{
+  error_t err;
+
+  /* These resources are freed in the function epilogue.  */
+  struct ps_context *context = NULL;
+  struct proc_stat_list *procset = NULL;
+
+  /* Print infos about this port.  */
+  err = print_port_info (name, 0, task, show, stdout);
+  if (err)
+    goto out;
+
+  static process_t proc = MACH_PORT_NULL;
+  if (proc == MACH_PORT_NULL)
+    proc = getproc ();
+
+  pid_t pid;
+  err = proc_task2pid (proc, task, &pid);
+  if (err)
+    goto out;
+
+  /* Get a list of all processes.  */
+  err = ps_context_create (getproc (), &context);
+  if (err)
+    goto out;
+
+  err = proc_stat_list_create (context, &procset);
+  if (err)
+    goto out;
+
+  err = proc_stat_list_add_all (procset, 0, 0);
+  if (err)
+    goto out;
+
+  for (unsigned i = 0; i < procset->num_procs; i++)
+    {
+      /* Ignore the target process.  */
+      if (procset->proc_stats[i]->pid == pid)
+       continue;
+
+      task_t xlate_task = MACH_PORT_NULL;
+      err = proc_pid2task (proc, procset->proc_stats[i]->pid, &xlate_task);
+      if (err || xlate_task == MACH_PORT_NULL)
+       continue;
+
+      struct port_name_xlator *xlator = NULL;
+      err = port_name_xlator_create (task, xlate_task, &xlator);
+      if (err)
+       goto loop_cleanup;
+
+      mach_port_t translated_port;
+      mach_msg_type_name_t translated_type;
+      err = port_name_xlator_xlate (xlator,
+                                   name, 0,
+                                   &translated_port, &translated_type);
+      if (err)
+       goto loop_cleanup;
+
+      /* The port translation was successful, print more infos.  */
+      printf ("% 5i -> % 5i: ", pid, procset->proc_stats[i]->pid);
+
+      err = print_xlated_port_info (name, 0, xlator, show, stdout);
+      if (err)
+       goto loop_cleanup;
+
+    loop_cleanup:
+      if (xlate_task)
+       mach_port_deallocate (mach_task_self (), xlate_task);
+
+      if (xlator)
+       port_name_xlator_free (xlator);
+    }
+
+  err = 0;
+
+ out:
+  if (procset != NULL)
+    proc_stat_list_free (procset);
+
+  if (context != NULL)
+    ps_context_free (context);
+
+  return err;
+}
+
+/* Locates all ports from TASK in any other process and prints the
+   mappings.  */
+error_t
+search_for_ports (task_t task, mach_port_type_t only, unsigned show)
+{
+  error_t err;
+
+  mach_port_t *names = NULL;
+  mach_port_type_t *types = NULL;
+  mach_msg_type_number_t names_len = 0;
+  mach_msg_type_number_t types_len = 0;
+  err = mach_port_names (task, &names, &names_len, &types, &types_len);
+  if (err)
+    return err;
+
+  for (mach_msg_type_number_t i = 0; i < names_len; i++)
+    if (types[i] & only)
+      search_for_port (task, names[i], show);
+
+  munmap ((caddr_t) names, names_len * sizeof *names);
+  munmap ((caddr_t) types, types_len * sizeof *types);
+
+  return 0;
+}
+
 static volatile int hold = 0;
 
 int
@@ -183,6 +301,8 @@ main (int argc, char **argv)
                  if (xlator)
                    err = print_xlated_task_ports_info (xlator, only,
                                                        show, stdout);
+                 else if (search)
+                   err = search_for_ports (task, only, show);
                  else
                    err = print_task_ports_info (task, only, show, stdout);
                  if (err)
@@ -206,6 +326,8 @@ main (int argc, char **argv)
                    if (err && no_translation_errors)
                      break;
                  }
+               else if (search)
+                   err = search_for_port (task, name, show);
                else
                  err = print_port_info (name, 0, task, show, stdout);
                if (err)
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index ef7ab53..d7ee203 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1,7 +1,7 @@
 /* Trace RPCs sent to selected ports
 
-   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2009, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2005, 2006, 2009, 2011,
+   2013 Free Software Foundation, Inc.
 
    This file is part of the GNU Hurd.
 
@@ -727,8 +727,6 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t 
*type,
        * has the receive right, we move the send right of the traced port to
        * the destination; otherwise, we move the one of the send wrapper.
        */
-      assert (req);
-
       /* See if this is already one of our own wrapper ports.  */
       send_wrapper = ports_lookup_port (traced_bucket, *right, 0);
       if (send_wrapper)
@@ -760,7 +758,7 @@ rewrite_right (mach_port_t *right, mach_msg_type_name_t 
*type,
          return TRACED_INFO (send_wrapper)->name;
        }
 
-      if (req->req_id == 3216)     /* mach_port_extract_right */
+      if (req && req->req_id == 3216)      /* mach_port_extract_right */
        receiver_info = discover_receive_right (*right, dest);
       else
        receiver_info = discover_receive_right (*right, source);
@@ -1286,24 +1284,34 @@ trace_and_forward (mach_msg_header_t *inp, 
mach_msg_header_t *outp)
        /* The reply port might be dead, e.g., the traced task has died. */
        && MACH_PORT_VALID (inp->msgh_local_port))
       {
-       struct send_once_info *info;
-       // TODO is the reply port always a send once right?
-       assert (reply_type == MACH_MSG_TYPE_PORT_SEND_ONCE);
-       info = new_send_once_wrapper (inp->msgh_local_port,
-                                     &inp->msgh_local_port);
-       reply_type = MACH_MSG_TYPE_MAKE_SEND_ONCE;
-       assert (inp->msgh_local_port);
-
-       if (TRACED_INFO (info)->name == 0)
+       switch (reply_type)
          {
-           if (msgid == 0)
-             asprintf (&TRACED_INFO (info)->name, "reply(%u:%u)",
-                       (unsigned int) TRACED_INFO (info)->pi.port_right,
-                       (unsigned int) inp->msgh_id);
-           else
-             asprintf (&TRACED_INFO (info)->name, "reply(%u:%s)",
-                       (unsigned int) TRACED_INFO (info)->pi.port_right,
-                       msgid->name);
+         case MACH_MSG_TYPE_PORT_SEND:
+           rewrite_right (&inp->msgh_local_port, &reply_type, NULL);
+           break;
+
+         case MACH_MSG_TYPE_PORT_SEND_ONCE:;
+           struct send_once_info *info;
+           info = new_send_once_wrapper (inp->msgh_local_port,
+                                         &inp->msgh_local_port);
+           reply_type = MACH_MSG_TYPE_MAKE_SEND_ONCE;
+           assert (inp->msgh_local_port);
+
+           if (TRACED_INFO (info)->name == 0)
+             {
+               if (msgid == 0)
+                 asprintf (&TRACED_INFO (info)->name, "reply(%u:%u)",
+                           (unsigned int) TRACED_INFO (info)->pi.port_right,
+                           (unsigned int) inp->msgh_id);
+               else
+                 asprintf (&TRACED_INFO (info)->name, "reply(%u:%s)",
+                           (unsigned int) TRACED_INFO (info)->pi.port_right,
+                           msgid->name);
+             }
+           break;
+
+         default:
+           error (1, 0, "Reply type %i not handled", reply_type);
          }
       }
 
@@ -1478,10 +1486,27 @@ static const char *const msg_types[] =
 };
 #endif
 
+/* We keep track of the last reply port used in a request we print to
+   ostream.  This way we can end incomplete requests with an ellipsis
+   and the name of the reply port.  When the reply finally arrives, we
+   start a new line with that port name and an ellipsis, making it
+   easy to match it to the associated request.  */
+static mach_port_t last_reply_port;
+
+/* Print an ellipsis if necessary.  */
+static void
+print_ellipsis (void)
+{
+  if (MACH_PORT_VALID (last_reply_port))
+    fprintf (ostream, " ...%u\n", (unsigned int) last_reply_port);
+}
+
 static void
 print_request_header (struct sender_info *receiver, mach_msg_header_t *msg)
 {
   const char *msgname = msgid_name (msg->msgh_id);
+  print_ellipsis ();
+  last_reply_port = msg->msgh_local_port;
 
   if (TRACED_INFO (receiver)->name != 0)
     fprintf (ostream, "%4s->", TRACED_INFO (receiver)->name);
@@ -1499,6 +1524,13 @@ static void
 print_reply_header (struct send_once_info *info, mig_reply_header_t *reply,
                    struct req_info *req)
 {
+  if (last_reply_port != info->pi.pi.port_right)
+    {
+      print_ellipsis ();
+      fprintf (ostream, "%u...", (unsigned int) info->pi.pi.port_right);
+    }
+  last_reply_port = MACH_PORT_NULL;
+
   /* We have printed a partial line for the request message,
      and now we have the corresponding reply.  */
   if (reply->Head.msgh_id == req->req_id + 100)
@@ -1520,6 +1552,20 @@ print_reply_header (struct send_once_info *info, 
mig_reply_header_t *reply,
     }
 }
 
+static char escape_sequences[0x100] =
+  {
+    ['\0'] = '0',
+    ['\a'] = 'a',
+    ['\b'] = 'b',
+    ['\f'] = 'f',
+    ['\n'] = 'n',
+    ['\r'] = 'r',
+    ['\t'] = 't',
+    ['\v'] = 'v',
+    ['\\'] = '\\',
+    ['\''] = '\'',
+    ['"'] = '"',
+  };
 
 static void
 print_data (mach_msg_type_name_t type,
@@ -1547,8 +1593,38 @@ print_data (mach_msg_type_name_t type,
     case MACH_MSG_TYPE_CHAR:
       if (nelt > strsize)
        nelt = strsize;
-      fprintf (ostream, "\"%.*s\"",
-              (int) (nelt * eltsize), (const char *) data);
+      fprintf (ostream, "\"");
+      /* Scan data for non-printable characters.  p always points to
+        the first character that has not yet been printed.  */
+      const char *p, *q;
+      p = q = (const char *) data;
+      while (*q && q - (const char *) data < (int) (nelt * eltsize))
+       {
+         if (isgraph (*q) || *q == ' ')
+           {
+             q += 1;
+             continue;
+           }
+
+         /* We encountered a non-printable character.  Print anything
+            that has not been printed so far.  */
+         if (p < q)
+           fprintf (ostream, "%.*s", q - p, p);
+
+         char c = escape_sequences[*((const unsigned char *) q)];
+         if (c)
+           fprintf (ostream, "\\%c", c);
+         else
+           fprintf (ostream, "\\x%02x", *((const unsigned char *) q));
+
+         q += 1;
+         p = q;
+       }
+
+      /* Print anything that has not been printed so far.  */
+      if (p < q)
+       fprintf (ostream, "%.*s", q - p, p);
+      fprintf (ostream, "\"");
       return;
 
 #if 0
diff --git a/utils/settrans.c b/utils/settrans.c
index a881401..ecc6d75 100644
--- a/utils/settrans.c
+++ b/utils/settrans.c
@@ -1,6 +1,6 @@
 /* Set a file's translator.
 
-   Copyright (C) 1995,96,97,98,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,2001,02,13 Free Software Foundation, Inc.
    Written by Miles Bader <address@hidden>
 
    This program is free software; you can redistribute it and/or
@@ -25,6 +25,7 @@
 #include <error.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <sys/wait.h>
 
 #include <error.h>
 #include <argz.h>
@@ -49,6 +50,8 @@ static struct argp_option options[] =
   {"passive",     'p', 0, 0, "Change NODE's passive translator record 
(default)" },
   {"create",      'c', 0, 0, "Create NODE if it doesn't exist" },
   {"dereference", 'L', 0, 0, "If a translator exists, put the new one on top"},
+  {"pid-file",    'F', "FILENAME", 0, "When starting an active translator,"
+     " write its pid to this file"},
   {"pause",       'P', 0, 0, "When starting an active translator, prompt and"
      " wait for a newline on stdin before completing the startup handshake"},
   {"timeout",     't',"SEC",0, "Timeout for translator startup, in seconds"
@@ -104,6 +107,7 @@ main(int argc, char *argv[])
   /* Various option flags.  */
   int passive = 0, active = 0, keep_active = 0, pause = 0, kill_active = 0,
       orphan = 0;
+  char *pid_file = NULL;
   int excl = 0;
   int timeout = DEFAULT_TIMEOUT * 1000; /* ms */
   char **chroot_command = 0;
@@ -136,6 +140,12 @@ main(int argc, char *argv[])
        case 'g': kill_active = 1; break;
        case 'x': excl = 1; break;
        case 'P': pause = 1; break;
+       case 'F':
+         pid_file = strdup (arg);
+         if (pid_file == NULL)
+           error(3, ENOMEM, "Failed to duplicate argument");
+         break;
+
        case 'o': orphan = 1; break;
 
        case 'C':
@@ -221,6 +231,17 @@ main(int argc, char *argv[])
              getchar ();
            }
 
+         if (pid_file != NULL)
+           {
+             FILE *h;
+             h = fopen (pid_file, "w");
+             if (h == NULL)
+               error (4, errno, "Failed to open pid file");
+
+             fprintf (h, "%i\n", task2pid (task));
+             fclose (h);
+           }
+
          node = file_name_lookup (node_name, flags | lookup_flags, 0666);
          if (node == MACH_PORT_NULL)
            {
@@ -259,33 +280,51 @@ main(int argc, char *argv[])
 
   if (chroot_command)
     {
-      /* We will act as the parent filesystem would for a lookup
-        of the active translator's root node, then use this port
-        as our root directory while we exec the command.  */
-
-      char retry_name[1024];   /* XXX */
-      retry_type do_retry;
-      mach_port_t root;
-      err = fsys_getroot (active_control,
-                         MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND,
-                         NULL, 0, NULL, 0, 0, &do_retry, retry_name, &root);
-      mach_port_deallocate (mach_task_self (), active_control);
-      if (err)
-       error (6, err, "fsys_getroot");
-      err = hurd_file_name_lookup_retry (&_hurd_ports_use, &getdport, 0,
-                                        do_retry, retry_name, 0, 0,
-                                        &root);
-      if (err)
-       error (6, err, "cannot resolve root port");
+      pid_t pid;
+      switch ((pid = fork ()))
+       {
+       case -1:
+         error (6, errno, "fork");
+
+       case 0:; /* Child.  */
+         /* We will act as the parent filesystem would for a lookup
+            of the active translator's root node, then use this port
+            as our root directory while we exec the command.  */
+
+         char retry_name[1024];        /* XXX */
+         retry_type do_retry;
+         mach_port_t root;
+         err = fsys_getroot (active_control,
+                             MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND,
+                             NULL, 0, NULL, 0, 0,
+                             &do_retry, retry_name, &root);
+         mach_port_deallocate (mach_task_self (), active_control);
+         if (err)
+           error (6, err, "fsys_getroot");
+         err = hurd_file_name_lookup_retry (&_hurd_ports_use, &getdport, 0,
+                                            do_retry, retry_name, 0, 0,
+                                            &root);
+         if (err)
+           error (6, err, "cannot resolve root port");
+
+         if (setcrdir (root))
+           error (7, errno, "cannot install root port");
+         mach_port_deallocate (mach_task_self (), root);
+         if (chdir ("/"))
+           error (8, errno, "cannot chdir to new root");
+
+         execvp (chroot_command[0], chroot_command);
+         error (8, errno, "cannot execute %s", chroot_command[0]);
+         break;
 
-      if (setcrdir (root))
-       error (7, errno, "cannot install root port");
-      mach_port_deallocate (mach_task_self (), root);
-      if (chdir ("/"))
-       error (8, errno, "cannot chdir to new root");
+       default: /* Parent.  */
+         if (waitpid (pid, NULL, 0) == -1)
+           error (8, errno, "waitpid");
 
-      execvp (chroot_command[0], chroot_command);
-      error (8, errno, "cannot execute %s", chroot_command[0]);
+         err = fsys_goaway (active_control, goaway_flags);
+         if (err && err != EBUSY)
+           error (9, err, "fsys_goaway");
+       }
     }
 
   return 0;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]