From 20d3ffa76a849e2105e72e6b7c8835de5e9c1b21 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 28 Feb 2014 11:26:07 +0100 Subject: term: fix receiver lookups in the tioctl server functions * term/mig-mutate.h: New file. * term/Makefile: Set tioctl-MIGSFLAGS. * term/ptyio.c: Fix receiver lookups in the tioctl server functions. * term/users.c: Likewise. --- term/ptyio.c | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'term/ptyio.c') diff --git a/term/ptyio.c b/term/ptyio.c index 2da7d6c8..211e70a8 100644 --- a/term/ptyio.c +++ b/term/ptyio.c @@ -512,12 +512,12 @@ pty_io_select (struct trivfs_protid *cred, mach_port_t reply, } error_t -S_tioctl_tiocsig (io_t port, +S_tioctl_tiocsig (struct trivfs_protid *cred, int sig) { - struct trivfs_protid *cred = ports_lookup_port (term_bucket, - port, pty_class); - if (!cred) + if (!cred + || cred->pi.bucket != term_bucket + || cred->pi.class != pty_class) return EOPNOTSUPP; pthread_mutex_lock (&global_lock); @@ -529,20 +529,18 @@ S_tioctl_tiocsig (io_t port, send_signal (sig); pthread_mutex_unlock (&global_lock); - ports_port_deref (cred); return 0; } error_t -S_tioctl_tiocpkt (io_t port, +S_tioctl_tiocpkt (struct trivfs_protid *cred, int mode) { error_t err; - - struct trivfs_protid *cred = ports_lookup_port (term_bucket, - port, pty_class); - if (!cred) + if (!cred + || cred->pi.bucket != term_bucket + || cred->pi.class != pty_class) return EOPNOTSUPP; pthread_mutex_lock (&global_lock); @@ -559,20 +557,18 @@ S_tioctl_tiocpkt (io_t port, } pthread_mutex_unlock (&global_lock); - ports_port_deref (cred); return err; } error_t -S_tioctl_tiocucntl (io_t port, +S_tioctl_tiocucntl (struct trivfs_protid *cred, int mode) { error_t err; - - struct trivfs_protid *cred = ports_lookup_port (term_bucket, - port, pty_class); - if (!cred) + if (!cred + || cred->pi.bucket != term_bucket + || cred->pi.class != pty_class) return EOPNOTSUPP; pthread_mutex_lock (&global_lock); @@ -589,19 +585,17 @@ S_tioctl_tiocucntl (io_t port, } pthread_mutex_unlock (&global_lock); - ports_port_deref (cred); return err; } error_t -S_tioctl_tiocremote (io_t port, +S_tioctl_tiocremote (struct trivfs_protid *cred, int how) { - struct trivfs_protid *cred = ports_lookup_port (term_bucket, - port, pty_class); - - if (!cred) + if (!cred + || cred->pi.bucket != term_bucket + || cred->pi.class != pty_class) return EOPNOTSUPP; pthread_mutex_lock (&global_lock); @@ -611,17 +605,16 @@ S_tioctl_tiocremote (io_t port, clear_queue (rawq); ptyio_notice_input_flushed (); pthread_mutex_unlock (&global_lock); - ports_port_deref (cred); return 0; } error_t -S_tioctl_tiocext (io_t port, +S_tioctl_tiocext (struct trivfs_protid *cred, int mode) { - struct trivfs_protid *cred = ports_lookup_port (term_bucket, - port, pty_class); - if (!cred) + if (!cred + || cred->pi.bucket != term_bucket + || cred->pi.class != pty_class) return EOPNOTSUPP; pthread_mutex_lock (&global_lock); @@ -646,6 +639,5 @@ S_tioctl_tiocext (io_t port, termstate.c_lflag &= ~EXTPROC; } pthread_mutex_unlock (&global_lock); - ports_port_deref (cred); return 0; } -- cgit v1.2.3