diff options
author | Roland McGrath <roland@gnu.org> | 2002-06-26 19:22:58 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-06-26 19:22:58 +0000 |
commit | 58dac2e796c106c068fd98302385eab0be35f16c (patch) | |
tree | 9c8381f93cbbc1f38a2755281ff0f1c3b6735fe0 /term/devio.c | |
parent | 715d9934e61502ac5c886deab06af48a45da111f (diff) |
2002-06-25 Roland McGrath <roland@frob.com>
* term.h (struct bottomhalf): New member `fini'.
* hurdio.c (hurdio_fini): New function.
(hurdio_bottom): Use it.
* devio.c (devio_fini): New function.
(devio_bottom): Use it.
* ptyio.c (ptyio_bottom): Add 0 entry for `fini'.
Diffstat (limited to 'term/devio.c')
-rw-r--r-- | term/devio.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/term/devio.c b/term/devio.c index 77b1b240..38eb996c 100644 --- a/term/devio.c +++ b/term/devio.c @@ -110,10 +110,34 @@ devio_init (void) if (err) return err; mach_port_deallocate (mach_task_self (), host_priv); + if (!phys_reply_class) phys_reply_class = ports_create_class (0, 0); return 0; } +static error_t +devio_fini (void) +{ + if (phys_reply_pi) + { + mach_port_deallocate (mach_task_self (), phys_reply); + phys_reply = MACH_PORT_NULL; + ports_port_deref (phys_reply_pi); + phys_reply_pi = 0; + } + if (phys_reply_writes_pi) + { + mach_port_deallocate (mach_task_self (), phys_reply_writes); + phys_reply_writes = MACH_PORT_NULL; + ports_port_deref (phys_reply_writes_pi); + phys_reply_writes_pi = 0; + } + mach_port_deallocate (mach_task_self (), phys_device); + mach_port_deallocate (mach_task_self (), device_master); + device_master = MACH_PORT_NULL; + return 0; +} + /* XXX Convert a real speed to a bogus Mach speed. Return -1 if the real speed was bogus, else 0. */ static int @@ -762,6 +786,7 @@ const struct bottomhalf devio_bottom = { TERM_ON_MACHDEV, devio_init, + devio_fini, NULL, devio_start_output, devio_set_break, |