summaryrefslogtreecommitdiff
path: root/libtrivfs/io-duplicate.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-05-10 19:38:52 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-05-10 19:38:52 +0000
commit2846530d8b4f821ed997125ddc853037ebf54554 (patch)
tree9f73844d94f3884554ebb170152f0fcff72aa1de /libtrivfs/io-duplicate.c
parent8dbc912abef8c395a92e52433318203741df1a78 (diff)
Formerly io-duplicate.c.~2~
Diffstat (limited to 'libtrivfs/io-duplicate.c')
-rw-r--r--libtrivfs/io-duplicate.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libtrivfs/io-duplicate.c b/libtrivfs/io-duplicate.c
index f49bb0d7..9cdefa71 100644
--- a/libtrivfs/io-duplicate.c
+++ b/libtrivfs/io-duplicate.c
@@ -24,12 +24,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
error_t
trivfs_S_io_duplicate (struct protid *cred,
mach_port_t *newport,
- mach_msg_type_name_t newporttype)
+ mach_msg_type_name_t *newporttype)
{
struct protid *newcred;
if (!cred)
return EOPNOTSUPP;
- newcred = ports_allocate_port (sizeof (struct protid), PT_PROTID);
-
+ newcred = ports_allocate_port (sizeof (struct protid),
+ trivfs_protid_porttype);
+ newcred->realnode = cred->realnode;
+ newcred->isroot = cred->isroot;
+ newcred->cntl = cred->cntl;
+ ports_port_ref (newcred->cntl);
+ mach_port_mod_refs (mach_task_self (), newcred->realnode,
+ MACH_PORT_RIGHT_SEND, 1);
+ *newport = ports_get_right (newcred);
+ *newporttype = MACH_MSG_TYPE_MAKE_SEND;
+ return 0;
+}
+