From 58dac2e796c106c068fd98302385eab0be35f16c Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 26 Jun 2002 19:22:58 +0000 Subject: 2002-06-25 Roland McGrath * 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'. --- term/devio.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'term/devio.c') 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, -- cgit v1.2.3