From b52531dc5b9e7a86eeb47adc8738e793edc31915 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Thu, 20 Jun 1996 23:54:07 +0000 Subject: Include and . (shutdown_notify_class): Declare variable. (S_startup_dosync): Give enough args to ports_lookup_port. (S_startup_dosync/do1): Return a value. (arrange_shutdown_notification): Correct spelling of ports_create_port. Initialize shutdown_notify_class. (find_device): Construct arg to strcmp correctly. Correct spelling of ENXIO. --- pfinet/main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pfinet/main.c b/pfinet/main.c index db8cab0e..256ad88d 100644 --- a/pfinet/main.c +++ b/pfinet/main.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include int trivfs_fstype = FSTYPE_MISC; int trivfs_fsid; @@ -36,6 +38,8 @@ int trivfs_protid_nportclasses = 1; struct port_class *trivfs_cntl_portclasses[1]; int trivfs_cntl_nportclasses = 1; +struct port_class *shutdown_notify_class; + /* Option parser. */ extern struct argp pfinet_argp; @@ -58,7 +62,7 @@ pfinet_demuxer (mach_msg_header_t *inp, error_t S_startup_dosync (mach_port_t handle) { - struct port_info *inpi = ports_lookup_port (pfinet_bucket, + struct port_info *inpi = ports_lookup_port (pfinet_bucket, handle, shutdown_notify_class); error_t do1 (void *port) @@ -67,6 +71,7 @@ S_startup_dosync (mach_port_t handle) if (pi->class == socketport_class) ports_destroy_right (pi); + return 0; } if (!inpi) @@ -84,10 +89,12 @@ arrange_shutdown_notification () process_t procserver; struct port_info *pi; + shutdown_notify_class = ports_create_class (0, 0); + /* Arrange to get notified when the system goes down, but if we fail for some reason, just silently give up. No big deal. */ - err = ports_crease_port (shutdown_notify_class, pfinet_bucket, + err = ports_create_port (shutdown_notify_class, pfinet_bucket, sizeof (struct port_info), &pi); if (err) return; @@ -118,7 +125,7 @@ error_t find_device (char *name, struct device **device) { if (already_open) - if (!name || strcmp (already_open, device) == 0) + if (!name || strcmp (already_open, (*device)->name) == 0) { *device = ðer_dev; return 0; @@ -126,7 +133,7 @@ find_device (char *name, struct device **device) else return EBUSY; /* XXXACK */ else if (! name) - return EXIO; /* XXX */ + return ENXIO; /* XXX */ name = already_open = strdup (name); -- cgit v1.2.3