summaryrefslogtreecommitdiff
path: root/term/ptyio.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-28 11:26:07 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-28 11:26:07 +0100
commit20d3ffa76a849e2105e72e6b7c8835de5e9c1b21 (patch)
tree499494cc69d012de99c840c53bcf0f50adf6b985 /term/ptyio.c
parenta876dbadbb1fa625e3e5fa8bdffe803e6eb473d1 (diff)
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.
Diffstat (limited to 'term/ptyio.c')
-rw-r--r--term/ptyio.c48
1 files changed, 20 insertions, 28 deletions
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;
}