summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-07-16 18:54:04 +0000
committerMiles Bader <miles@gnu.org>1997-07-16 18:54:04 +0000
commitf997b508bef36f52cd942b75b9ac893a5887d01e (patch)
tree1fd96e3e9cee207a4e2ed751a24d777441bae0f4
parent8ba3d92e48fe96e1cb9380c5f989441017ce053f (diff)
(trivfs_S_io_map):
Make sure there are enough references to MEMOBJ for both read & write ports.
-rw-r--r--storeio/io.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/storeio/io.c b/storeio/io.c
index 07f6494c..8b31a3e6 100644
--- a/storeio/io.c
+++ b/storeio/io.c
@@ -1,6 +1,6 @@
/* The hurd io interface to storeio
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -35,6 +35,7 @@
objects can still be accessed by io_read and io_write. */
error_t
trivfs_S_io_map (struct trivfs_protid *cred,
+ mach_port_t reply, mach_msg_type_name_t reply_type,
memory_object_t *rd_obj, mach_msg_type_name_t *rd_type,
memory_object_t *wr_obj, mach_msg_type_name_t *wr_type)
{
@@ -43,28 +44,27 @@ trivfs_S_io_map (struct trivfs_protid *cred,
else
{
mach_port_t memobj;
- struct open *open = (struct open *)cred->po->hook;
- error_t err = dev_get_memory_object (open->dev, &memobj);
+ error_t err =
+ dev_get_memory_object (((struct open *)cred->po->hook)->dev, &memobj);
if (!err)
{
if (cred->po->openmodes & O_READ)
- {
- *rd_obj = memobj;
- *rd_type = MACH_MSG_TYPE_MOVE_SEND;
- }
+ *rd_obj = memobj;
else
*rd_obj = MACH_PORT_NULL;
-
if (cred->po->openmodes & O_WRITE)
- {
- *wr_obj = memobj;
- *wr_type = MACH_MSG_TYPE_MOVE_SEND;
- }
+ *wr_obj = memobj;
else
*wr_obj = MACH_PORT_NULL;
+
+ if ((cred->po->openmodes & (O_READ|O_WRITE)) == (O_READ|O_WRITE))
+ mach_port_mod_refs (mach_task_self (), memobj,
+ MACH_PORT_RIGHT_SEND, 1);
}
+ *rd_type = *wr_type = MACH_MSG_TYPE_MOVE_SEND;
+
return err;
}
}