summaryrefslogtreecommitdiff
path: root/console/console.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2002-09-22 00:17:43 +0000
committerMarcus Brinkmann <marcus@gnu.org>2002-09-22 00:17:43 +0000
commit18e5ffbf236c2a9c6877ddcbf33d6f8f28a4e71c (patch)
tree5c4d1fbff709ea88ec3128236eb0807740ed1100 /console/console.c
parentad94dc77e49b4da363df6658f9050bb9c4a1f428 (diff)
2002-09-22 Marcus Brinkmann <marcus@gnu.org>
* console.c: Include <mach.h>. (netfs_S_dir_notice_changes): New variable PREQ. Clean out the dead wood, eh, dead name notifications from the CONS->dirmod_req list. * display.c (struct user_pager_info): Drop members DISPLAY and P. (struct display): Remove member UPI and add member PAGER. (pager_report_extent): Remove local variable DISPLAY, use UPI directly. (user_create): New variable UPI to hold the user pager info. Modify the code to match new struct organization. (user_destroy): Unmap the user data. (display_notice_changes): Request dead-name notifications. (free_modreqs): Cancel dead-name notification request before deallocation send right. (display_notice_filechange): Likewise. (do_mach_notify_msg_accepted): Likewise. (display_destroy): Take DISPLAY->lock while operating. Reset the filemod_reqs and filemod_reqs_pending members of DISPLAY to NULL. (do_mach_notify_port_deleted): Add comment. (do_mach_notify_dead_name): Implement. (do_mach_notify_no_senders): Implement by delegating to libports. (do_mach_notify_send_once): Don't fail.
Diffstat (limited to 'console/console.c')
-rw-r--r--console/console.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/console/console.c b/console/console.c
index 48567e1f..2969f8f8 100644
--- a/console/console.c
+++ b/console/console.c
@@ -35,6 +35,7 @@
#include <version.h>
+#include <mach.h>
#include <hurd/netfs.h>
#include <hurd/ioctl_types.h>
/* We include console.h for the color numbers. */
@@ -1239,6 +1240,7 @@ netfs_S_dir_notice_changes (struct protid *cred, mach_port_t notify)
{
error_t err;
cons_t cons;
+ struct modreq **preq;
struct modreq *req;
if (!cred)
@@ -1249,6 +1251,31 @@ netfs_S_dir_notice_changes (struct protid *cred, mach_port_t notify)
return EOPNOTSUPP;
mutex_lock (&cons->lock);
+ /* We have to prevent that we accumulate dead-names in the
+ notification list. They are cleaned up in cons_notice_dirchange,
+ but that is not called often enough, so we also clean them up
+ here. This way, the maximum of dead-names will never exceed the
+ prior maximum of active clients. The better way would be to
+ request dead-name notifications, XXX. */
+ preq = &cons->dirmod_reqs;
+
+ while (*preq)
+ {
+ mach_port_type_t type;
+ req = *preq;
+
+ err = mach_port_type (mach_task_self (), req->port, &type);
+ if (!err && type == MACH_PORT_TYPE_DEAD_NAME)
+ {
+ /* Remove notify port. */
+ *preq = req->next;
+ mach_port_deallocate (mach_task_self (), req->port);
+ free (req);
+ }
+ else
+ preq = &req->next;
+ }
+
err = dir_changed (notify, cons->dirmod_tick, DIR_CHANGED_NULL, "");
if (err)
{