summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--term/devio.c25
-rw-r--r--term/ptyio.c3
-rw-r--r--term/term.h1
3 files changed, 28 insertions, 1 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,
diff --git a/term/ptyio.c b/term/ptyio.c
index 98fb5052..9c1509ff 100644
--- a/term/ptyio.c
+++ b/term/ptyio.c
@@ -276,7 +276,8 @@ const struct bottomhalf ptyio_bottom =
{
TERM_ON_MASTERPTY,
ptyio_init,
- NULL,
+ NULL, /* fini */
+ NULL, /* gwinsz */
ptyio_start_output,
ptyio_set_break,
ptyio_clear_break,
diff --git a/term/term.h b/term/term.h
index db2be09c..15e888b9 100644
--- a/term/term.h
+++ b/term/term.h
@@ -144,6 +144,7 @@ struct bottomhalf
{
enum term_bottom_type type;
error_t (*init) (void);
+ error_t (*fini) (void);
error_t (*gwinsz) (struct winsize *size);
error_t (*start_output) (void);
error_t (*set_break) (void);