commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 29/87: hurd: fix receiver lookup in termctty_open_terminal


From: Samuel Thibault
Subject: [hurd] 29/87: hurd: fix receiver lookup in termctty_open_terminal
Date: Sun, 09 Nov 2014 11:05:01 +0000

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

sthibault pushed a commit to branch upstream
in repository hurd.

commit 6f874305906b18a6bd7ba02f7dee949948e41262
Author: Justus Winter <address@hidden>
Date:   Tue Jun 10 16:20:37 2014 +0200

    hurd: fix receiver lookup in termctty_open_terminal
    
    * hurd/hurd_types.h (ctty_t): New type definition.
    * hurd/term.defs (ctty_t): New type definition.
    * term/mig-decls.h: New file.
    * term/mig-mutate.h: Add mutators, includes.
    * term/term.h: Add include guards.
    * term/users.c (S_termctty_open_terminal): Fix receiver lookup.
    * boot/boot.c (S_termctty_open_terminal): Likewise.
---
 boot/boot.c                        |  2 +-
 hurd/hurd_types.h                  |  1 +
 hurd/term.defs                     | 14 +++++++++++++-
 term/{mig-mutate.h => mig-decls.h} | 27 ++++++++++++++++++++++-----
 term/mig-mutate.h                  | 10 +++++++++-
 term/term.h                        |  5 +++++
 term/users.c                       |  4 +---
 7 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/boot/boot.c b/boot/boot.c
index ed29014..03617f5 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -1876,7 +1876,7 @@ S_io_revoke (mach_port_t obj,
    support on the console device.  */
 
 kern_return_t
-S_termctty_open_terminal (mach_port_t object,
+S_termctty_open_terminal (ctty_t object,
                          int flags,
                          mach_port_t *result,
                          mach_msg_type_name_t *restype)
diff --git a/hurd/hurd_types.h b/hurd/hurd_types.h
index 8eac206..4341177 100644
--- a/hurd/hurd_types.h
+++ b/hurd/hurd_types.h
@@ -49,6 +49,7 @@ typedef mach_port_t fs_notify_t;
 typedef mach_port_t exec_startup_t;
 typedef mach_port_t interrupt_t;
 typedef mach_port_t proccoll_t;
+typedef mach_port_t ctty_t;
 
 #include <errno.h>             /* Defines `error_t'.  */
 
diff --git a/hurd/term.defs b/hurd/term.defs
index 17ba4f3..45d825d 100644
--- a/hurd/term.defs
+++ b/hurd/term.defs
@@ -29,6 +29,18 @@ TERM_IMPORTS
 
 INTR_INTERFACE
 
+type ctty_t = mach_port_copy_send_t
+#ifdef CTTY_INTRAN
+intran: CTTY_INTRAN
+#endif
+#ifdef CTTY_OUTTRAN
+outtran: CTTY_OUTTRAN
+#endif
+#ifdef CTTY_DESTRUCTOR
+destructor: CTTY_DESTRUCTOR
+#endif
+;
+
 /* Find out what the controlling terminal ID port is.  */
 routine term_getctty (
        terminal: io_t;
@@ -109,7 +121,7 @@ routine term_on_pty (
    not be made to terminal I/O ports.  Return an unauthenticated I/O
    port for the terminal opened as with flags FLAGS. */
 routine termctty_open_terminal (
-       ctty: mach_port_t;
+       ctty: ctty_t;
        flags: int;
        out terminal: mach_port_send_t);
 
diff --git a/term/mig-mutate.h b/term/mig-decls.h
similarity index 62%
copy from term/mig-mutate.h
copy to term/mig-decls.h
index a6b99fe..c91b133 100644
--- a/term/mig-mutate.h
+++ b/term/mig-decls.h
@@ -17,9 +17,26 @@
    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/>.  */
 
-/* Only CPP macro definitions should go in this file. */
+#ifndef __TERM_MIG_DECLS_H__
+#define __TERM_MIG_DECLS_H__
 
-#define IO_INTRAN trivfs_protid_t trivfs_begin_using_protid (io_t)
-#define IO_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t)
-#define TIOCTL_IMPORTS import "../libtrivfs/mig-decls.h";
-#define TERM_IMPORTS import "../libtrivfs/mig-decls.h";
+#include <hurd/ports.h>
+
+#include "term.h"
+
+/* Called by server stub functions.  */
+
+static inline struct port_info * __attribute__ ((unused))
+begin_using_ctty_port (mach_port_t port)
+{
+  return ports_lookup_port (term_bucket, port, cttyid_class);
+}
+
+static inline void __attribute__ ((unused))
+end_using_ctty (struct port_info *p)
+{
+  if (p)
+    ports_port_deref (p);
+}
+
+#endif /* __TERM_MIG_DECLS_H__ */
diff --git a/term/mig-mutate.h b/term/mig-mutate.h
index a6b99fe..1545719 100644
--- a/term/mig-mutate.h
+++ b/term/mig-mutate.h
@@ -21,5 +21,13 @@
 
 #define IO_INTRAN trivfs_protid_t trivfs_begin_using_protid (io_t)
 #define IO_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t)
+
+#define CTTY_INTRAN                                    \
+  port_info_t begin_using_ctty_port (mach_port_t)
+#define CTTY_DESTRUCTOR                                        \
+  end_using_ctty (port_info_t)
+
 #define TIOCTL_IMPORTS import "../libtrivfs/mig-decls.h";
-#define TERM_IMPORTS import "../libtrivfs/mig-decls.h";
+#define TERM_IMPORTS                                   \
+  import "../libtrivfs/mig-decls.h";                   \
+  import "mig-decls.h";
diff --git a/term/term.h b/term/term.h
index df82b6c..3067425 100644
--- a/term/term.h
+++ b/term/term.h
@@ -18,6 +18,9 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */
 
+#ifndef __HURD_TERM_H__
+#define __HURD_TERM_H__
+
 #include <pthread.h>
 #include <assert.h>
 #include <errno.h>
@@ -391,3 +394,5 @@ error_t pty_io_select (struct trivfs_protid *, mach_port_t,
 error_t pty_open_hook (struct trivfs_control *, struct iouser *, int);
 error_t pty_po_create_hook (struct trivfs_peropen *);
 error_t pty_po_destroy_hook (struct trivfs_peropen *);
+
+#endif /* __HURD_TERM_H__ */
diff --git a/term/users.c b/term/users.c
index 9bd51d0..8151dc7 100644
--- a/term/users.c
+++ b/term/users.c
@@ -379,7 +379,7 @@ S_term_getctty (struct trivfs_protid *cred,
 
 /* Implement termctty_open_terminal as described in <hurd/term.defs>.  */
 kern_return_t
-S_termctty_open_terminal (mach_port_t arg,
+S_termctty_open_terminal (struct port_info *pi,
                          int flags,
                          mach_port_t *result,
                          mach_msg_type_name_t *resulttype)
@@ -388,7 +388,6 @@ S_termctty_open_terminal (mach_port_t arg,
   mach_port_t new_realnode;
   struct iouser *user;
   struct trivfs_protid *newcred;
-  struct port_info *pi = ports_lookup_port (term_bucket, arg, cttyid_class);
   if (!pi)
     return EOPNOTSUPP;
 
@@ -409,7 +408,6 @@ S_termctty_open_terminal (mach_port_t arg,
        }
     }
 
-  ports_port_deref (pi);
   return err;
 }
 

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