diff options
author | Thomas Bushnell <thomas@gnu.org> | 1999-03-15 20:05:48 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1999-03-15 20:05:48 +0000 |
commit | 0af047580d3888861521979e4999722ccf9288f7 (patch) | |
tree | 4179e6bd4a65d537f030466521e13d40d8482134 /term | |
parent | d4e55aef9516d2426ade8d35421f12c2eb5ed793 (diff) |
Mon Mar 15 14:58:33 1999 Thomas Bushnell, BSG <tb@mit.edu>
* users.c (S_term_get_peername): Implement new RPC.
* users.c (S_term_get_nodename): Return ENOENT if the name is not
set.
Diffstat (limited to 'term')
-rw-r--r-- | term/ChangeLog | 7 | ||||
-rw-r--r-- | term/users.c | 36 |
2 files changed, 42 insertions, 1 deletions
diff --git a/term/ChangeLog b/term/ChangeLog index c4a44b3f..92002cda 100644 --- a/term/ChangeLog +++ b/term/ChangeLog @@ -1,3 +1,10 @@ +Mon Mar 15 14:58:33 1999 Thomas Bushnell, BSG <tb@mit.edu> + + * users.c (S_term_get_peername): Implement new RPC. + + * users.c (S_term_get_nodename): Return ENOENT if the name is not + set. + 1999-03-13 Mark Kettenis <kettenis@gnu.org> * users.c (po_destroy_hook): Only reset state and hardware if diff --git a/term/users.c b/term/users.c index 16e83ee9..828b1a3d 100644 --- a/term/users.c +++ b/term/users.c @@ -2151,7 +2151,13 @@ S_term_get_nodename (io_t arg, if (!cred) return EOPNOTSUPP; - strcpy (name, (char *)cred->po->cntl->hook ?: ""); + if (!cred->po->cntl->hook) + { + ports_port_deref (cred); + return ENOENT; + } + + strcpy (name, (char *)cred->po->cntl->hook); ports_port_deref (cred); return 0; @@ -2187,6 +2193,34 @@ S_term_set_filenode (io_t arg, } kern_return_t +S_term_get_peername (io_t arg, + char *name) +{ + struct trivfs_protid *cred = ports_lookup_port (term_bucket, arg, 0); + struct trivfs_control *peer; + + if (!cred || (cred->pi.class != tty_class && cred->pi.class != pty_class)) + { + if (cred) + ports_port_deref (cred); + return EOPNOTSUPP; + } + + peer = (cred->pi.class == tty_class) ? ptyctl : termctl; + + if (bottom != ptyio_bottom || !peer->hook) + { + port_port_deref (cred); + return ENOENT; + } + + strcpy (name, (char *) peer->hook); + ports_port_deref (cred); + + return 0; +} + +kern_return_t S_term_get_bottom_type (io_t arg, int *ttype) { |