commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 01/03: New upstream snapshot


From: Samuel Thibault
Subject: [hurd] 01/03: New upstream snapshot
Date: Tue, 04 Feb 2014 17:25:26 +0000

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

sthibault pushed a commit to branch master
in repository hurd.

commit 482909a28d10503e1c6ee5beb25415e178af2fa7
Author: Samuel Thibault <address@hidden>
Date:   Mon Feb 3 22:41:58 2014 +0000

    New upstream snapshot
---
 auth/auth.c                    | 10 ++---
 daemons/getty.c                | 86 ++++++++++++++++++++++++++++++++++++++----
 exec/main.c                    |  6 +--
 libdiskfs/demuxer.c            | 18 ++++-----
 libdiskfs/dir-link.c           | 26 ++++++-------
 libdiskfs/dir-unlink.c         | 20 +++++-----
 libdiskfs/file-get-trans.c     | 26 ++++++-------
 libdiskfs/file-get-transcntl.c | 16 ++++----
 libdiskfs/file-set-trans.c     | 60 ++++++++++++++---------------
 libdiskfs/fsys-getroot.c       | 56 +++++++++++++--------------
 libnetfs/demuxer.c             | 14 +++----
 libnetfs/release-peropen.c     |  5 +++
 libps/procstat.c               | 24 ++++++++----
 libps/ps.h                     |  1 +
 libps/spec.c                   |  6 +--
 libshouldbeinlibc/wire.c       | 12 +++---
 libtrivfs/demuxer.c            | 13 +++----
 pfinet/ethernet.c              | 40 ++++++++++++++++++--
 pfinet/main.c                  | 11 +++---
 pfinet/options.c               |  5 +--
 pflocal/pflocal.c              |  3 +-
 pflocal/sserver.c              | 10 ++---
 proc/main.c                    | 10 ++---
 proc/mgt.c                     |  7 +---
 proc/mig-decls.h               | 42 +++++++++++++++++++++
 proc/proc_exc.defs             |  8 +++-
 trans/Makefile                 |  6 ++-
 trans/password.c               | 30 +++++++++------
 utils/fakeauth.c               |  6 +--
 29 files changed, 373 insertions(+), 204 deletions(-)

diff --git a/auth/auth.c b/auth/auth.c
index a395e79..e69c4f8 100644
--- a/auth/auth.c
+++ b/auth/auth.c
@@ -464,18 +464,16 @@ S_auth_server_authenticate (struct authhandle *serverauth,
 }
 
 
+#include "../libports/notify_S.h"
+#include "../libports/interrupt_S.h"
 
 static int
 auth_demuxer (mach_msg_header_t *inp, mach_msg_header_t *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 = ports_interrupt_server_routine (inp)) ||
+      (routine = ports_notify_server_routine (inp)))
     {
       (*routine) (inp, outp);
       return TRUE;
diff --git a/daemons/getty.c b/daemons/getty.c
index 5a2896d..7112660 100644
--- a/daemons/getty.c
+++ b/daemons/getty.c
@@ -1,6 +1,7 @@
 /* Stubby version of getty for Hurd
 
-   Copyright (C) 1996, 1998, 1999, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 1999, 2007, 2014
+     Free Software Foundation, Inc.
 
    Written by Michael I. Bushnell, p/BSG.
 
@@ -39,6 +40,7 @@
 extern char *localhost ();
 
 #define _PATH_LOGIN "/bin/login"
+#define _PATH_ISSUE "/etc/issue"
 
 /* Parse the terminal speed.  */
 static void
@@ -59,22 +61,92 @@ set_speed (int tty, char *speedstr)
     tcsetattr (tty, TCSAFLUSH, &ttystat);
 }
 
+/* Load a banner from _PATH_ISSUE.  If that fails, a built-in version
+   is provided.  */
+static char *
+load_banner (void)
+{
+  char *buf = NULL, *p;
+  struct stat st;
+  int fd;
+  ssize_t remaining, count;
+
+  fd = open (_PATH_ISSUE, O_RDONLY);
+  if (fd == -1)
+    goto out;
+
+  if (fstat (fd, &st) == -1)
+    goto out;
+
+  buf = malloc (st.st_size + 1);
+  if (buf == NULL)
+    goto out;
+
+  remaining = st.st_size;
+  p = buf;
+  while (remaining > 0)
+    {
+      count = read (fd, p, remaining);
+      if (count == -1)
+        {
+          close (fd);
+          goto out;
+        }
+      p += count;
+      remaining -= count;
+    }
+
+  buf[st.st_size] = '\0';
+  close (fd);
+  return buf;
+
+ out:
+  free (buf);
+  return "\r\n\n\\s \\r (\\n) (\\l)\r\n\n";
+}
 
 /* Print a suitable welcome banner */
 static void
 print_banner (int fd, char *ttyname)
 {
-  int cc;
-  char *s;
+  char *s, *t, *expansion;
   struct utsname u;
-  char *hostname = localhost ();
 
   if (uname (&u))
     u.sysname[0] = u.release[0] = '\0';
 
-  cc = asprintf (&s, "\r\n\n%s %s (%s) (%s)\r\n\n",
-                u.sysname, u.release, hostname ?: "?", basename (ttyname));
-  write (fd, s, cc);
+  for (s = load_banner (); *s; s++)
+    {
+      for (t = s; *t && *t != '\\'; t++) /* nomnomnom */;
+
+      write (fd, s, t - s);
+      if (! *t)
+        return;
+
+      switch (*(t + 1))
+        {
+        case '\\':
+          expansion = "\\";
+          break;
+        case 's':
+          expansion = u.sysname;
+          break;
+        case 'r':
+          expansion = u.release;
+          break;
+        case 'n':
+          expansion = localhost () ?: "?";
+          break;
+        case 'l':
+          expansion = basename (ttyname);
+          break;
+        default:
+          expansion = "?";
+        }
+      write (fd, expansion, strlen (expansion));
+
+      s = t + 1;
+    }
 }
 
 int
diff --git a/exec/main.c b/exec/main.c
index 41b1db4..c1f347c 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -46,12 +46,12 @@ struct trivfs_control *fsys;
 char **save_argv;
 
 
+#include "exec_S.h"
+#include "exec_startup_S.h"
+
 static int
 exec_demuxer (mach_msg_header_t *inp, mach_msg_header_t *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)) ||
diff --git a/libdiskfs/demuxer.c b/libdiskfs/demuxer.c
index 5412f26..4a1c4fb 100644
--- a/libdiskfs/demuxer.c
+++ b/libdiskfs/demuxer.c
@@ -17,19 +17,19 @@
 
 #include "priv.h"
 
+#include "io_S.h"
+#include "fs_S.h"
+#include "../libports/notify_S.h"
+#include "fsys_S.h"
+#include "../libports/interrupt_S.h"
+#include "ifsock_S.h"
+#include "startup_notify_S.h"
+#include "exec_startup_S.h"
+
 int
 diskfs_demuxer (mach_msg_header_t *inp,
                mach_msg_header_t *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)) ||
diff --git a/libdiskfs/dir-link.c b/libdiskfs/dir-link.c
index 45d8894..ca5dd56 100644
--- a/libdiskfs/dir-link.c
+++ b/libdiskfs/dir-link.c
@@ -29,7 +29,7 @@ diskfs_S_dir_link (struct protid *dircred,
   struct node *tnp;            /* node being deleted implicitly */
   struct node *dnp;            /* directory of new entry */
   struct dirstat *ds = alloca (diskfs_dirstat_size);
-  error_t error;
+  error_t err;
 
   if (!dircred)
     return EOPNOTSUPP;
@@ -53,19 +53,19 @@ diskfs_S_dir_link (struct protid *dircred,
   pthread_mutex_lock (&dnp->lock);
 
   /* Lookup new location */
-  error = diskfs_lookup (dnp, name, RENAME, &tnp, ds, dircred);
-  if (!error && excl)
+  err = diskfs_lookup (dnp, name, RENAME, &tnp, ds, dircred);
+  if (!err && excl)
     {
-      error = EEXIST;
+      err = EEXIST;
       diskfs_nput (tnp);
     }
-  if (error && error != ENOENT)
+  if (err && err != ENOENT)
     {
-      if (error == EAGAIN)
-       error = EINVAL;
+      if (err == EAGAIN)
+       err = EINVAL;
       diskfs_drop_dirstat (dnp, ds);
       pthread_mutex_unlock (&dnp->lock);
-      return error;
+      return err;
     }
 
   if (np == tnp)
@@ -107,8 +107,8 @@ diskfs_S_dir_link (struct protid *dircred,
   if (tnp)
     {
       assert (!excl);
-      error = diskfs_dirrewrite (dnp, tnp, np, name, ds);
-      if (!error)
+      err = diskfs_dirrewrite (dnp, tnp, np, name, ds);
+      if (!err)
        {
          /* Deallocate link on TNP */
          tnp->dn_stat.st_nlink--;
@@ -119,15 +119,15 @@ diskfs_S_dir_link (struct protid *dircred,
       diskfs_nput (tnp);
     }
   else
-    error = diskfs_direnter (dnp, name, np, ds, dircred);
+    err = diskfs_direnter (dnp, name, np, ds, dircred);
 
   if (diskfs_synchronous)
     diskfs_node_update (dnp, 1);
 
   pthread_mutex_unlock (&dnp->lock);
   pthread_mutex_unlock (&np->lock);
-  if (!error)
+  if (!err)
     /* MiG won't do this for us, which it ought to. */
     mach_port_deallocate (mach_task_self (), filecred->pi.port_right);
-  return error;
+  return err;
 }
diff --git a/libdiskfs/dir-unlink.c b/libdiskfs/dir-unlink.c
index f687a16..cf02c22 100644
--- a/libdiskfs/dir-unlink.c
+++ b/libdiskfs/dir-unlink.c
@@ -27,7 +27,7 @@ diskfs_S_dir_unlink (struct protid *dircred,
   struct node *dnp;
   struct node *np;
   struct dirstat *ds = alloca (diskfs_dirstat_size);
-  error_t error;
+  error_t err;
   mach_port_t control = MACH_PORT_NULL;
 
   if (!dircred)
@@ -39,14 +39,14 @@ diskfs_S_dir_unlink (struct protid *dircred,
 
   pthread_mutex_lock (&dnp->lock);
 
-  error = diskfs_lookup (dnp, name, REMOVE, &np, ds, dircred);
-  if (error == EAGAIN)
-    error = EPERM;     /* 1003.1-1996 5.5.1.4 */
-  if (error)
+  err = diskfs_lookup (dnp, name, REMOVE, &np, ds, dircred);
+  if (err == EAGAIN)
+    err = EPERM;       /* 1003.1-1996 5.5.1.4 */
+  if (err)
     {
       diskfs_drop_dirstat (dnp, ds);
       pthread_mutex_unlock (&dnp->lock);
-      return error;
+      return err;
     }
 
   /* This isn't the BSD behavior, but it is Posix compliant and saves
@@ -62,14 +62,14 @@ diskfs_S_dir_unlink (struct protid *dircred,
       return EPERM;            /* 1003.1-1996 5.5.1.4 */
     }
 
-  error = diskfs_dirremove (dnp, np, name, ds);
+  err = diskfs_dirremove (dnp, np, name, ds);
   if (diskfs_synchronous)
     diskfs_node_update (dnp, 1);
-  if (error)
+  if (err)
     {
       diskfs_nput (np);
       pthread_mutex_unlock (&dnp->lock);
-      return error;
+      return err;
     }
 
   np->dn_stat.st_nlink--;
@@ -94,5 +94,5 @@ diskfs_S_dir_unlink (struct protid *dircred,
       mach_port_deallocate (mach_task_self (), control);
     }
 
-  return error;
+  return err;
 }
diff --git a/libdiskfs/file-get-trans.c b/libdiskfs/file-get-trans.c
index 11ed439..db5bbda 100644
--- a/libdiskfs/file-get-trans.c
+++ b/libdiskfs/file-get-trans.c
@@ -28,7 +28,7 @@ diskfs_S_file_get_translator (struct protid *cred,
                              size_t *translen)
 {
   struct node *np;
-  error_t error = 0;
+  error_t err = 0;
 
   if (!cred)
     return EOPNOTSUPP;
@@ -48,16 +48,16 @@ diskfs_S_file_get_translator (struct protid *cred,
       bcopy (_HURD_SYMLINK, *trans, sizeof _HURD_SYMLINK);
 
       if (diskfs_read_symlink_hook)
-       error = (*diskfs_read_symlink_hook) (np,
+       err = (*diskfs_read_symlink_hook) (np,
                                             *trans + sizeof _HURD_SYMLINK);
-      if (!diskfs_read_symlink_hook || error == EINVAL)
+      if (!diskfs_read_symlink_hook || err == EINVAL)
        {
-         error = diskfs_node_rdwr (np, *trans + sizeof _HURD_SYMLINK,
+         err = diskfs_node_rdwr (np, *trans + sizeof _HURD_SYMLINK,
                                    0, np->dn_stat.st_size, 0, cred, &amt);
-         if (!error)
+         if (!err)
            assert (amt == np->dn_stat.st_size);
        }
-      if (!error)
+      if (!err)
        {
          (*trans)[sizeof _HURD_SYMLINK + np->dn_stat.st_size] = '\0';
          *translen = len;
@@ -88,7 +88,7 @@ diskfs_S_file_get_translator (struct protid *cred,
       bcopy (buf, *trans, buflen);
       free (buf);
       *translen = buflen;
-      error = 0;
+      err = 0;
     }
   else if (S_ISFIFO (np->dn_stat.st_mode))
     {
@@ -99,7 +99,7 @@ diskfs_S_file_get_translator (struct protid *cred,
        *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
       bcopy (_HURD_FIFO, *trans, sizeof _HURD_FIFO);
       *translen = len;
-      error = 0;
+      err = 0;
     }
   else if (S_ISSOCK (np->dn_stat.st_mode))
     {
@@ -110,18 +110,18 @@ diskfs_S_file_get_translator (struct protid *cred,
        *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
       bcopy (_HURD_IFSOCK, *trans, sizeof _HURD_IFSOCK);
       *translen = len;
-      error = 0;
+      err = 0;
     }
   else
     {
       if (! (np->dn_stat.st_mode & S_IPTRANS))
-       error = EINVAL;
+       err = EINVAL;
       else
        {
          char *string;
          u_int len;
-         error = diskfs_get_translator (np, &string, &len);
-         if (!error)
+         err = diskfs_get_translator (np, &string, &len);
+         if (!err)
            {
              if (len > *translen)
                *trans = mmap (0, len, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
@@ -134,5 +134,5 @@ diskfs_S_file_get_translator (struct protid *cred,
 
   pthread_mutex_unlock (&np->lock);
 
-  return error;
+  return err;
 }
diff --git a/libdiskfs/file-get-transcntl.c b/libdiskfs/file-get-transcntl.c
index c7fad91..311d23e 100644
--- a/libdiskfs/file-get-transcntl.c
+++ b/libdiskfs/file-get-transcntl.c
@@ -25,7 +25,7 @@ diskfs_S_file_get_translator_cntl (struct protid *cred,
                                   mach_msg_type_name_t *ctltype)
 {
   struct node *np;
-  error_t error;
+  error_t err;
   
   if (!cred)
     return EOPNOTSUPP;
@@ -34,15 +34,15 @@ diskfs_S_file_get_translator_cntl (struct protid *cred,
 
   pthread_mutex_lock (&np->lock);
 
-  error = fshelp_isowner (&np->dn_stat, cred->user);
-  if (!error)
-    error = fshelp_fetch_control (&np->transbox, ctl);
-  if (!error && *ctl == MACH_PORT_NULL)
-    error = ENXIO;
-  if (!error)
+  err = fshelp_isowner (&np->dn_stat, cred->user);
+  if (!err)
+    err = fshelp_fetch_control (&np->transbox, ctl);
+  if (!err && *ctl == MACH_PORT_NULL)
+    err = ENXIO;
+  if (!err)
     *ctltype = MACH_MSG_TYPE_MOVE_SEND;
 
   pthread_mutex_unlock (&np->lock);
 
-  return error;
+  return err;
 }
diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c
index 58f6255..6e1a61d 100644
--- a/libdiskfs/file-set-trans.c
+++ b/libdiskfs/file-set-trans.c
@@ -32,7 +32,7 @@ diskfs_S_file_set_translator (struct protid *cred,
                              fsys_t active)
 {
   struct node *np;
-  error_t error;
+  error_t err;
   mach_port_t control = MACH_PORT_NULL;
 
   if (!cred)
@@ -51,32 +51,32 @@ diskfs_S_file_set_translator (struct protid *cred,
 
   pthread_mutex_lock (&np->lock);
 
-  error = fshelp_isowner (&np->dn_stat, cred->user);
-  if (error)
+  err = fshelp_isowner (&np->dn_stat, cred->user);
+  if (err)
     {
       pthread_mutex_unlock (&np->lock);
-      return error;
+      return err;
     }
 
   if ((active_flags & FS_TRANS_SET)
       && ! (active_flags & FS_TRANS_ORPHAN))
     {
-      error = fshelp_fetch_control (&np->transbox, &control);
-      if (error)
+      err = fshelp_fetch_control (&np->transbox, &control);
+      if (err)
        {
          pthread_mutex_unlock (&np->lock);
-         return error;
+         return err;
        }
 
       if ((control != MACH_PORT_NULL) && ((active_flags & FS_TRANS_EXCL) == 0))
        {
          pthread_mutex_unlock (&np->lock);
-         error = fsys_goaway (control, killtrans_flags);
+         err = fsys_goaway (control, killtrans_flags);
          mach_port_deallocate (mach_task_self (), control);
-         if (error && (error != MIG_SERVER_DIED)
-             && (error != MACH_SEND_INVALID_DEST))
-           return error;
-         error = 0;
+         if (err && (err != MIG_SERVER_DIED)
+             && (err != MACH_SEND_INVALID_DEST))
+           return err;
+         err = 0;
          pthread_mutex_lock (&np->lock);
        }
       else if (control != MACH_PORT_NULL)
@@ -94,12 +94,12 @@ diskfs_S_file_set_translator (struct protid *cred,
 
   if (active_flags & FS_TRANS_SET)
     {
-      error = fshelp_set_active (&np->transbox, active,
+      err = fshelp_set_active (&np->transbox, active,
                                 active_flags & FS_TRANS_EXCL);
-      if (error)
+      if (err)
        {
          pthread_mutex_unlock (&np->lock);
-         return error;
+         return err;
        }
     }
 
@@ -158,12 +158,12 @@ diskfs_S_file_set_translator (struct protid *cred,
                    }
                  minor = strtol (arg, 0, 0);
 
-                 error = diskfs_validate_rdev_change (np,
+                 err = diskfs_validate_rdev_change (np,
                                                       makedev (major, minor));
-                 if (error)
+                 if (err)
                    {
                      pthread_mutex_unlock (&np->lock);
-                     return error;
+                     return err;
                    }
                  np->dn_stat.st_rdev = makedev (major, minor);
                }
@@ -180,36 +180,36 @@ diskfs_S_file_set_translator (struct protid *cred,
                    }
 
                  if (diskfs_create_symlink_hook)
-                   error = (*diskfs_create_symlink_hook)(np, arg);
-                 if (!diskfs_create_symlink_hook || error == EINVAL)
+                   err = (*diskfs_create_symlink_hook)(np, arg);
+                 if (!diskfs_create_symlink_hook || err == EINVAL)
                    /* Store the argument in the file as the
                       target of the link */
-                   error = diskfs_node_rdwr (np, arg, 0, strlen (arg),
+                   err = diskfs_node_rdwr (np, arg, 0, strlen (arg),
                                              1, cred, 0);
-                 if (error)
+                 if (err)
                    {
                      pthread_mutex_unlock (&np->lock);
-                     return error;
+                     return err;
                    }
                }
              newmode = (np->dn_stat.st_mode & ~S_IFMT) | newmode;
-             error = diskfs_validate_mode_change (np, newmode);
-             if (!error)
+             err = diskfs_validate_mode_change (np, newmode);
+             if (!err)
                {
                  np->dn_stat.st_mode = newmode;
                  diskfs_node_update (np, diskfs_synchronous);
                }
              pthread_mutex_unlock (&np->lock);
-             return error;
+             return err;
            }
        }
-      error = diskfs_set_translator (np, passive, passivelen, cred);
+      err = diskfs_set_translator (np, passive, passivelen, cred);
     }
 
   pthread_mutex_unlock (&np->lock);
 
-  if (! error && cred->po->path && active_flags & FS_TRANS_SET)
-    error = fshelp_set_active_translator (&cred->pi, cred->po->path, active);
+  if (! err && cred->po->path && active_flags & FS_TRANS_SET)
+    err = fshelp_set_active_translator (&cred->pi, cred->po->path, active);
 
-  return error;
+  return err;
 }
diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c
index 39973a8..85e1167 100644
--- a/libdiskfs/fsys-getroot.c
+++ b/libdiskfs/fsys-getroot.c
@@ -42,7 +42,7 @@ diskfs_S_fsys_getroot (fsys_t controlport,
 {
   struct port_info *pt = ports_lookup_port (diskfs_port_bucket, controlport,
                                            diskfs_control_class);
-  error_t error = 0;
+  error_t err = 0;
   mode_t type;
   struct protid *newpi;
   struct peropen *newpo;
@@ -79,23 +79,23 @@ diskfs_S_fsys_getroot (fsys_t controlport,
        || fshelp_translated (&diskfs_root_node->transbox))
       && !(flags & O_NOTRANS))
     {
-      error = fshelp_fetch_root (&diskfs_root_node->transbox,
+      err = fshelp_fetch_root (&diskfs_root_node->transbox,
                                 &peropen_context, dotdot, &user, flags,
                                 _diskfs_translator_callback1,
                                 _diskfs_translator_callback2,
                                 retry, retryname, returned_port);
-      if (error != ENOENT)
+      if (err != ENOENT)
        {
          pthread_mutex_unlock (&diskfs_root_node->lock);
          pthread_rwlock_unlock (&diskfs_fsys_lock);
          drop_idvec ();
-         if (!error)
+         if (!err)
            *returned_port_poly = MACH_MSG_TYPE_MOVE_SEND;
-         return error;
+         return err;
        }
 
       /* ENOENT means the translator was removed in the interim. */
-      error = 0;
+      err = 0;
     }
 
   if (type == S_IFLNK && !(flags & (O_NOLINK | O_NOTRANS)))
@@ -105,19 +105,19 @@ diskfs_S_fsys_getroot (fsys_t controlport,
       size_t amt;
 
       if (diskfs_read_symlink_hook)
-       error = (*diskfs_read_symlink_hook) (diskfs_root_node, pathbuf);
-      if (!diskfs_read_symlink_hook || error == EINVAL)
-       error = diskfs_node_rdwr (diskfs_root_node, pathbuf, 0,
+       err = (*diskfs_read_symlink_hook) (diskfs_root_node, pathbuf);
+      if (!diskfs_read_symlink_hook || err == EINVAL)
+       err = diskfs_node_rdwr (diskfs_root_node, pathbuf, 0,
                                  diskfs_root_node->dn_stat.st_size, 0,
                                  0, &amt);
       pathbuf[amt] = '\0';
 
       pthread_mutex_unlock (&diskfs_root_node->lock);
       pthread_rwlock_unlock (&diskfs_fsys_lock);
-      if (error)
+      if (err)
        {
          drop_idvec ();
-         return error;
+         return err;
        }
 
       if (pathbuf[0] == '/')
@@ -144,31 +144,31 @@ diskfs_S_fsys_getroot (fsys_t controlport,
   if ((type == S_IFSOCK || type == S_IFBLK
        || type == S_IFCHR || type == S_IFIFO)
       && (flags & (O_READ|O_WRITE|O_EXEC)))
-    error = EOPNOTSUPP;
+    err = EOPNOTSUPP;
 
-  if (!error && (flags & O_READ))
-    error = fshelp_access (&diskfs_root_node->dn_stat, S_IREAD, &user);
+  if (!err && (flags & O_READ))
+    err = fshelp_access (&diskfs_root_node->dn_stat, S_IREAD, &user);
 
-  if (!error && (flags & O_EXEC))
-    error = fshelp_access (&diskfs_root_node->dn_stat, S_IEXEC, &user);
+  if (!err && (flags & O_EXEC))
+    err = fshelp_access (&diskfs_root_node->dn_stat, S_IEXEC, &user);
 
-  if (!error && (flags & (O_WRITE)))
+  if (!err && (flags & (O_WRITE)))
     {
       if (type == S_IFDIR)
-       error = EISDIR;
+       err = EISDIR;
       else if (diskfs_check_readonly ())
-       error = EROFS;
+       err = EROFS;
       else
-       error = fshelp_access (&diskfs_root_node->dn_stat,
+       err = fshelp_access (&diskfs_root_node->dn_stat,
                               S_IWRITE, &user);
     }
 
-  if (error)
+  if (err)
     {
       pthread_mutex_unlock (&diskfs_root_node->lock);
       pthread_rwlock_unlock (&diskfs_fsys_lock);
       drop_idvec ();
-      return error;
+      return err;
     }
 
   if ((flags & O_NOATIME)
@@ -178,16 +178,16 @@ diskfs_S_fsys_getroot (fsys_t controlport,
 
   flags &= ~OPENONLY_STATE_MODES;
 
-  error = diskfs_make_peropen (diskfs_root_node, flags,
+  err = diskfs_make_peropen (diskfs_root_node, flags,
                               &peropen_context, &newpo);
-  if (! error)
+  if (! err)
     {
-      error = diskfs_create_protid (newpo, &user, &newpi);
-      if (error)
+      err = diskfs_create_protid (newpo, &user, &newpi);
+      if (err)
        diskfs_release_peropen (newpo);
     }
 
-  if (! error)
+  if (! err)
     {
       mach_port_deallocate (mach_task_self (), dotdot);
       *retry = FS_RETRY_NORMAL;
@@ -204,5 +204,5 @@ diskfs_S_fsys_getroot (fsys_t controlport,
 
   drop_idvec ();
 
-  return error;
+  return err;
 }
diff --git a/libnetfs/demuxer.c b/libnetfs/demuxer.c
index 8ef4d86..4c20ab6 100644
--- a/libnetfs/demuxer.c
+++ b/libnetfs/demuxer.c
@@ -20,17 +20,17 @@
 
 #include "netfs.h"
 
+#include "io_S.h"
+#include "fs_S.h"
+#include "../libports/notify_S.h"
+#include "fsys_S.h"
+#include "../libports/interrupt_S.h"
+#include "ifsock_S.h"
+
 int
 netfs_demuxer (mach_msg_header_t *inp,
               mach_msg_header_t *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)) ||
diff --git a/libnetfs/release-peropen.c b/libnetfs/release-peropen.c
index d4d3574..c206b43 100644
--- a/libnetfs/release-peropen.c
+++ b/libnetfs/release-peropen.c
@@ -18,6 +18,7 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */
 
+#include <sys/file.h>
 #include "netfs.h"
 
 void
@@ -39,6 +40,10 @@ netfs_release_peropen (struct peropen *po)
       if (po->shadow_root_parent)
        mach_port_deallocate (mach_task_self (), po->shadow_root_parent);
 
+      if (po->lock_status != LOCK_UN)
+       fshelp_acquire_lock (&po->np->userlock, &po->lock_status,
+                            &po->np->lock, LOCK_UN);
+
       netfs_nput (po->np);
 
       free (po->path);
diff --git a/libps/procstat.c b/libps/procstat.c
index e732f75..0d4a565 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -294,6 +294,8 @@ add_preconditions (ps_flags_t flags, struct ps_context 
*context)
     /* We just request the resources require for both the thread and task
        versions, as the extraneous info won't be possible to acquire anyway. */
     flags |= PSTAT_TASK_BASIC | PSTAT_THREAD_BASIC;
+  if (flags & PSTAT_TIMES)
+    flags |= PSTAT_TASK_BASIC | PSTAT_THREAD_BASIC;
   if (flags & (PSTAT_CTTYID | PSTAT_CWDIR | PSTAT_AUTH | PSTAT_UMASK)
       && !(flags & PSTAT_NO_MSGPORT))
     {
@@ -348,11 +350,10 @@ should_suppress_msgport (struct proc_stat *ps)
    thread take precedence over waiting ones, and if there are any other
    incompatible states, simply using a bogus value of -1.  */
 static struct thread_basic_info *
-summarize_thread_basic_info (struct procinfo *pi)
+summarize_thread_basic_info (struct procinfo *pi, ps_flags_t have)
 {
   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;
@@ -427,11 +428,14 @@ 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;
+  /* For tasks, include the run time of terminated threads.  */
+  if (have & PSTAT_TASK_BASIC)
+    {
+      tbi->user_time.seconds += pi->taskinfo.user_time.seconds;
+      tbi->user_time.microseconds += pi->taskinfo.user_time.microseconds;
+      tbi->system_time.seconds += pi->taskinfo.system_time.seconds;
+      tbi->system_time.microseconds += pi->taskinfo.system_time.microseconds;
+    }
 
   tbi->user_time.seconds += tbi->user_time.microseconds / 1000000;
   tbi->user_time.microseconds %= 1000000;
@@ -655,7 +659,7 @@ set_procinfo_flags (struct proc_stat *ps, ps_flags_t need, 
ps_flags_t have)
       if (had & PSTAT_THREAD_BASIC)
        free (ps->thread_basic_info);
       if (have & PSTAT_THREAD_BASIC)
-       ps->thread_basic_info = summarize_thread_basic_info (pi);
+       ps->thread_basic_info = summarize_thread_basic_info (pi, have);
       if (had & PSTAT_THREAD_SCHED)
        free (ps->thread_sched_info);
       if (have & PSTAT_THREAD_SCHED)
@@ -1007,6 +1011,10 @@ proc_stat_set_flags (struct proc_stat *ps, ps_flags_t 
flags)
   MGET (PSTAT_NUM_PORTS, PSTAT_PID,
         proc_getnports (server, ps->pid, &ps->num_ports));
 
+  /* User and system times.  */
+  if ((need & PSTAT_TIMES) && (have & (PSTAT_TASK_BASIC | PSTAT_THREAD_BASIC)))
+    have |= PSTAT_TIMES;
+
   /* Update PS's flag state.  We haven't tried user flags yet, so don't mark
      them as having failed.  We do this before checking user bits so that the
      user fetch hook sees PS in a consistent state.  */
diff --git a/libps/ps.h b/libps/ps.h
index bcc43f8..06af96b 100644
--- a/libps/ps.h
+++ b/libps/ps.h
@@ -343,6 +343,7 @@ struct proc_stat
 #define PSTAT_UMASK          0x400000 /* The proc's current umask */
 #define PSTAT_HOOK           0x800000 /* Has a non-zero hook */
 #define PSTAT_NUM_PORTS      0x4000000 /* Number of Mach ports in the task */
+#define PSTAT_TIMES          0x8000000 /* Task/thread user and system times */
 
 /* Flag bits that don't correspond precisely to any field.  */
 #define PSTAT_NO_MSGPORT     0x1000000 /* Don't use the msgport at all */
diff --git a/libps/spec.c b/libps/spec.c
index 146aba5..d645b82 100644
--- a/libps/spec.c
+++ b/libps/spec.c
@@ -196,7 +196,7 @@ ps_get_usr_time (struct proc_stat *ps, struct timeval *tv)
   tv->tv_usec = tvt.microseconds;
 }
 const struct ps_getter ps_usr_time_getter =
-{"usr_time", PSTAT_THREAD_BASIC, ps_get_usr_time};
+{"usr_time", PSTAT_TIMES, ps_get_usr_time};
 
 static void
 ps_get_sys_time (struct proc_stat *ps, struct timeval *tv)
@@ -206,7 +206,7 @@ ps_get_sys_time (struct proc_stat *ps, struct timeval *tv)
   tv->tv_usec = tvt.microseconds;
 }
 const struct ps_getter ps_sys_time_getter =
-{"sys_time", PSTAT_THREAD_BASIC, ps_get_sys_time};
+{"sys_time", PSTAT_TIMES, ps_get_sys_time};
 
 static void
 ps_get_tot_time (struct proc_stat *ps, struct timeval *tv)
@@ -217,7 +217,7 @@ ps_get_tot_time (struct proc_stat *ps, struct timeval *tv)
   tv->tv_usec = tvt.microseconds;
 }
 const struct ps_getter ps_tot_time_getter =
-{"tot_time", PSTAT_THREAD_BASIC, ps_get_tot_time};
+{"tot_time", PSTAT_TIMES, ps_get_tot_time};
 
 static void
 ps_get_start_time (struct proc_stat *ps, struct timeval *tv)
diff --git a/libshouldbeinlibc/wire.c b/libshouldbeinlibc/wire.c
index b954095..ca5d32b 100644
--- a/libshouldbeinlibc/wire.c
+++ b/libshouldbeinlibc/wire.c
@@ -139,10 +139,10 @@ wire_segment (vm_address_t start,
              vm_size_t len)
 {
   mach_port_t host, device;
-  error_t error;
+  error_t err;
 
-  error = get_privileged_ports (&host, &device);
-  if (!error)
+  err = get_privileged_ports (&host, &device);
+  if (!err)
     {
       wire_segment_internal (start, len, host);
       mach_port_deallocate (mach_task_self (), host);
@@ -158,11 +158,11 @@ wire_task_self ()
 {
   struct link_map *map;
   mach_port_t host, device;
-  error_t error;
+  error_t err;
   extern char _edata, _etext, __data_start;
 
-  error = get_privileged_ports (&host, &device);
-  if (error)
+  err = get_privileged_ports (&host, &device);
+  if (err)
     return;
 
   map = loaded ();
diff --git a/libtrivfs/demuxer.c b/libtrivfs/demuxer.c
index 411699f..306cd11 100644
--- a/libtrivfs/demuxer.c
+++ b/libtrivfs/demuxer.c
@@ -21,17 +21,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 
02139, USA.  */
 
 #include "priv.h"
 
+#include "trivfs_io_S.h"
+#include "trivfs_fs_S.h"
+#include "../libports/notify_S.h"
+#include "trivfs_fsys_S.h"
+#include "../libports/interrupt_S.h"
+
 int
 trivfs_demuxer (mach_msg_header_t *inp,
                mach_msg_header_t *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)) ||
diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c
index 768d528..053fd1b 100644
--- a/pfinet/ethernet.c
+++ b/pfinet/ethernet.c
@@ -233,6 +233,19 @@ ethernet_open (struct device *dev)
   return 0;
 }
 
+int
+ethernet_close (struct device *dev)
+{
+  struct ether_device *edev = (struct ether_device *) dev->priv;
+
+  mach_port_deallocate (mach_task_self (), edev->readptname);
+  edev->readptname = MACH_PORT_NULL;
+  ports_destroy_right (edev->readpt);
+  edev->readpt = NULL;
+  device_close (edev->ether_port);
+  mach_port_deallocate (mach_task_self (), edev->ether_port);
+  edev->ether_port = MACH_PORT_NULL;
+}
 
 /* Transmit an ethernet frame */
 int
@@ -241,10 +254,31 @@ ethernet_xmit (struct sk_buff *skb, struct device *dev)
   error_t err;
   struct ether_device *edev = (struct ether_device *) dev->priv;
   u_int count;
+  u_int tried = 0;
+
+  do
+    {
+      tried++;
+      err = device_write (edev->ether_port, D_NOWAIT, 0, skb->data, skb->len, 
&count);
+      if (err == EMACH_SEND_INVALID_DEST || err == EMIG_SERVER_DIED)
+       {
+         /* Device probably just died, try to reopen it.  */
+
+         if (tried == 2)
+           /* Too many tries, abort */
+           break;
+
+         ethernet_close (dev);
+         ethernet_open (dev);
+       }
+      else
+       {
+         assert_perror (err);
+         assert (count == skb->len);
+       }
+    }
+  while (err);
 
-  err = device_write (edev->ether_port, D_NOWAIT, 0, skb->data, skb->len, 
&count);
-  assert_perror (err);
-  assert (count == skb->len);
   dev_kfree_skb (skb);
   return 0;
 }
diff --git a/pfinet/main.c b/pfinet/main.c
index dce1600..a596e18 100644
--- a/pfinet/main.c
+++ b/pfinet/main.c
@@ -72,16 +72,17 @@ const char *argp_program_version = STANDARD_HURD_VERSION 
(pfinet);
 /* Option parser.  */
 extern struct argp pfinet_argp;
 
+#include "io_S.h"
+#include "socket_S.h"
+#include "pfinet_S.h"
+#include "iioctl_S.h"
+#include "startup_notify_S.h"
+
 int
 pfinet_demuxer (mach_msg_header_t *inp,
                mach_msg_header_t *outp)
 {
   struct port_info *pi;
-  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.  */
diff --git a/pfinet/options.c b/pfinet/options.c
index 1d0a9e1..e9b81a9 100644
--- a/pfinet/options.c
+++ b/pfinet/options.c
@@ -540,16 +540,15 @@ trivfs_append_args (struct trivfs_control *fsys, char 
**argz, size_t *argz_len)
 
       if (idev)
        {
-         struct inet6_ifaddr *ifa = idev->addr_list;
+         struct inet6_ifaddr *ifa;
          static char addr_buf[INET6_ADDRSTRLEN];
 
          /* Push all IPv6 addresses assigned to the interface. */
-         do 
+         for (ifa = idev->addr_list; ifa; ifa = ifa->if_next)
            {
              inet_ntop (AF_INET6, &ifa->addr, addr_buf, INET6_ADDRSTRLEN);
              ADD_OPT ("--address6=%s/%d", addr_buf, ifa->prefix_len);
            }
-         while ((ifa = ifa->if_next));
 
          /* Last not least push --gateway6 option. */
          struct rt6_info *rt6i = ipv6_get_dflt_router ();
diff --git a/pflocal/pflocal.c b/pflocal/pflocal.c
index d51f721..fcb62d1 100644
--- a/pflocal/pflocal.c
+++ b/pflocal/pflocal.c
@@ -46,13 +46,12 @@ int trivfs_protid_nportclasses = 1;
 int trivfs_cntl_nportclasses = 1;
 
 /* ---------------------------------------------------------------- */
+#include "socket_S.h"
 
 /* A demuxer to separate out pf-level operations on our node.  */
 static int
 pf_demuxer (mach_msg_header_t *inp, mach_msg_header_t *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)))
diff --git a/pflocal/sserver.c b/pflocal/sserver.c
index 4ce26b1..7df69a4 100644
--- a/pflocal/sserver.c
+++ b/pflocal/sserver.c
@@ -32,15 +32,15 @@ struct port_bucket *sock_port_bucket;
 static int sock_server_active = 0;
 static pthread_spinlock_t sock_server_active_lock = 
PTHREAD_SPINLOCK_INITIALIZER;
 
+#include "io_S.h"
+#include "socket_S.h"
+#include "../libports/interrupt_S.h"
+#include "../libports/notify_S.h"
+
 /* A demuxer for socket operations.  */
 static int
 sock_demuxer (mach_msg_header_t *inp, mach_msg_header_t *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)) ||
diff --git a/proc/main.c b/proc/main.c
index 5d6dc21..73742ed 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -34,15 +34,15 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 
02139, USA.  */
 
 const char *argp_program_version = STANDARD_HURD_VERSION (proc);
 
+#include "process_S.h"
+#include "notify_S.h"
+#include "../libports/interrupt_S.h"
+#include "proc_exc_S.h"
+
 int
 message_demuxer (mach_msg_header_t *inp,
                 mach_msg_header_t *outp)
 {
-  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)) ||
diff --git a/proc/mgt.c b/proc/mgt.c
index 602ba84..5e0accd 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -417,7 +417,7 @@ S_proc_handle_exceptions (struct proc *p,
    the thread_set_state requested by proc_handle_exceptions and then
    send an exception_raise message as requested. */
 kern_return_t
-S_proc_exception_raise (mach_port_t excport,
+S_proc_exception_raise (struct exc *e,
                        mach_port_t reply,
                        mach_msg_type_name_t reply_type,
                        mach_port_t thread,
@@ -428,8 +428,7 @@ S_proc_exception_raise (mach_port_t excport,
 {
   error_t err;
   struct proc *p;
-  struct exc *e = ports_lookup_port (proc_bucket, excport, exc_class);
-  if (!e)
+  if (!e || e->pi.bucket != proc_bucket || e->pi.class != exc_class)
     return EOPNOTSUPP;
 
   p = task_find (task);
@@ -455,7 +454,6 @@ S_proc_exception_raise (mach_port_t excport,
         the faulting thread's state to run its recovery code, which should
         dequeue that message.  */
       err = thread_set_state (thread, e->flavor, e->thread_state, e->statecnt);
-      ports_port_deref (e);
       mach_port_deallocate (mach_task_self (), thread);
       mach_port_deallocate (mach_task_self (), task);
       if (err)
@@ -484,7 +482,6 @@ S_proc_exception_raise (mach_port_t excport,
       /* Nuke the task; we will get a notification message and report that
         it died with SIGNO.  */
       task_terminate (task);
-      ports_port_deref (e);
 
       /* In the MACH_SEND_NOTIFY_IN_PROGRESS case, the kernel did a
         pseudo-receive of the RPC request message that may have added user
diff --git a/proc/mig-decls.h b/proc/mig-decls.h
new file mode 100644
index 0000000..0d5bd4d
--- /dev/null
+++ b/proc/mig-decls.h
@@ -0,0 +1,42 @@
+/* Translation functions for mig.
+
+   Copyright (C) 2013 Free Software Foundation, Inc.
+
+   Written by Justus Winter <address@hidden>
+
+   This file is part of the GNU Hurd.
+
+   The GNU Hurd is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   The GNU Hurd is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with the GNU Hurd.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef __MIG_DECLS_H__
+#define __MIG_DECLS_H__
+
+#include "proc.h"
+
+typedef struct exc* exc_t;
+
+static inline exc_t __attribute__ ((unused))
+begin_using_exc_port (mach_port_t port)
+{
+  return ports_lookup_port (NULL, port, exc_class);
+}
+
+static inline void __attribute__ ((unused))
+end_using_exc (exc_t exc)
+{
+  if (exc != NULL)
+    ports_port_deref (exc);
+}
+
+#endif
diff --git a/proc/proc_exc.defs b/proc/proc_exc.defs
index e9c58f1..c910824 100644
--- a/proc/proc_exc.defs
+++ b/proc/proc_exc.defs
@@ -33,9 +33,15 @@ subsystem proc_exc 2400;
 #include <mach/std_types.defs>
 
 ServerPrefix S_;
+import "mig-decls.h";
+
+type exception_t = mach_port_copy_send_t
+       cusertype: mach_port_t
+       intran: exc_t begin_using_exc_port (exception_t)
+       destructor: end_using_exc (exc_t);
 
 routine proc_exception_raise (
-       exception_port: mach_port_t;
+       exception_port: exception_t;
        replyport reply: mach_port_poly_t;
        msgoption flags: integer_t;
        thread: mach_port_t;
diff --git a/trans/Makefile b/trans/Makefile
index 291df2f..c0386d0 100644
--- a/trans/Makefile
+++ b/trans/Makefile
@@ -1,6 +1,6 @@
 #
 #   Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2006, 2007,
-#   2008 Free Software Foundation, Inc.
+#   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
@@ -32,6 +32,10 @@ OBJS = $(SRCS:.c=.o) fsysServer.o ifsockServer.o 
passwordServer.o \
 HURDLIBS = ports netfs trivfs iohelp fshelp pipe ihash shouldbeinlibc
 LDLIBS += -lpthread
 password-LDLIBS = $(LIBCRYPT)
+password-MIGSFLAGS=\
+    "-DIO_INTRAN=trivfs_protid_t trivfs_begin_using_protid (io_t)" \
+    "-DIO_DESTRUCTOR=trivfs_end_using_protid (trivfs_protid_t)" \
+    "-DPASSWORD_IMPORTS=import <hurd/trivfs.h>;"
 
 include ../Makeconf
 
diff --git a/trans/password.c b/trans/password.c
index 6f15a9e..344b78b 100644
--- a/trans/password.c
+++ b/trans/password.c
@@ -1,5 +1,5 @@
 /* Hurd standard password server.
-   Copyright (C) 1999 Free Software Foundation
+   Copyright (C) 1999, 2013 Free Software Foundation
    Written by Mark Kettenis.
 
    The GNU Hurd is free software; you can redistribute it and/or
@@ -135,10 +135,9 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
 
 /* Implement password_check_user as described in <hurd/password.defs>.  */
 kern_return_t
-S_password_check_user (io_t server, uid_t user, char *pw,
+S_password_check_user (struct trivfs_protid *cred, uid_t user, char *pw,
                       mach_port_t *port, mach_msg_type_name_t *port_type)
 {
-  struct trivfs_protid *cred;
   struct ugids ugids = UGIDS_INIT;
   auth_t auth;
   error_t err;
@@ -150,10 +149,16 @@ S_password_check_user (io_t server, uid_t user, char *pw,
       return strdup (pw);
     }
 
-  cred = ports_lookup_port (port_bucket, server, trivfs_protid_portclasses[0]);
   if (! cred)
     return EOPNOTSUPP;
 
+  if (cred->pi.bucket != port_bucket ||
+      cred->pi.class != trivfs_protid_portclasses[0])
+    {
+      ports_port_deref (cred);
+      return EOPNOTSUPP;
+    }
+
   /* Verify password.  */
   err = ugids_add_user (&ugids, user, 1);
   if (!err)
@@ -173,17 +178,14 @@ S_password_check_user (io_t server, uid_t user, char *pw,
     }
 
   ugids_fini (&ugids);
-
-  ports_port_deref (cred);
   return err;
 }
 
 /* Implement password_check_group as described in <hurd/password.defs>.  */
 kern_return_t
-S_password_check_group (io_t server, uid_t group, char *pw,
+S_password_check_group (struct trivfs_protid *cred, uid_t group, char *pw,
                        mach_port_t *port, mach_msg_type_name_t *port_type)
 {
-  struct trivfs_protid *cred;
   struct ugids ugids = UGIDS_INIT;
   auth_t auth;
   error_t err;
@@ -195,10 +197,16 @@ S_password_check_group (io_t server, uid_t group, char 
*pw,
       return strdup (pw);
     }
 
-  cred = ports_lookup_port (port_bucket, server, trivfs_protid_portclasses[0]);
   if (! cred)
     return EOPNOTSUPP;
-  
+
+  if (cred->pi.bucket != port_bucket ||
+      cred->pi.class != trivfs_protid_portclasses[0])
+    {
+      ports_port_deref (cred);
+      return EOPNOTSUPP;
+    }
+
   /* Verify password.  */
   err = ugids_add_gid (&ugids, group, 1);
   if (!err)
@@ -218,7 +226,5 @@ S_password_check_group (io_t server, uid_t group, char *pw,
     }
 
   ugids_fini (&ugids);
-
-  ports_port_deref (cred);
   return err;
 }
diff --git a/utils/fakeauth.c b/utils/fakeauth.c
index 2c72c89..660295f 100644
--- a/utils/fakeauth.c
+++ b/utils/fakeauth.c
@@ -299,13 +299,11 @@ S_interrupt_operation (mach_port_t port, 
mach_port_seqno_t seqno)
   return interrupt_operation (real_auth_port, 0);
 }
 
+#include "../libports/notify_S.h"
+
 static int
 auth_demuxer (mach_msg_header_t *inp, mach_msg_header_t *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)) ||

-- 
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]