summaryrefslogtreecommitdiff
path: root/libmachdev
diff options
context:
space:
mode:
Diffstat (limited to 'libmachdev')
-rw-r--r--libmachdev/ds_routines.c6
-rw-r--r--libmachdev/machdev-device_emul.h2
-rw-r--r--libmachdev/machdev.h2
-rw-r--r--libmachdev/trivfs_server.c31
4 files changed, 19 insertions, 22 deletions
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index c2de4b26..ac915166 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -315,13 +315,13 @@ void machdev_device_init()
}
}
-void machdev_device_shutdown(mach_port_t dosync_handle)
+void machdev_device_sync()
{
int i;
for (i = 0; i < num_emul; i++)
{
- if (emulation_list[i]->shutdown)
- emulation_list[i]->shutdown(dosync_handle);
+ if (emulation_list[i]->sync)
+ emulation_list[i]->sync();
}
}
diff --git a/libmachdev/machdev-device_emul.h b/libmachdev/machdev-device_emul.h
index 7748f37f..9f7b0b21 100644
--- a/libmachdev/machdev-device_emul.h
+++ b/libmachdev/machdev-device_emul.h
@@ -64,7 +64,7 @@ struct machdev_device_emulation_ops
recnum_t, vm_offset_t, vm_size_t);
io_return_t (*writev_trap) (void *, dev_mode_t,
recnum_t, io_buf_vec_t *, vm_size_t);
- void (*shutdown) (mach_port_t);
+ void (*sync) (void);
};
#endif /* _MACHDEV_DEVICE_EMUL_H_ */
diff --git a/libmachdev/machdev.h b/libmachdev/machdev.h
index 5d0eed02..7ac42eed 100644
--- a/libmachdev/machdev.h
+++ b/libmachdev/machdev.h
@@ -30,7 +30,7 @@
void machdev_register (struct machdev_device_emulation_ops *ops);
void machdev_device_init(void);
-void machdev_device_shutdown(mach_port_t dosync_handle);
+void machdev_device_sync(void);
void * machdev_server(void *);
error_t machdev_create_device_port (size_t size, void *result);
int machdev_trivfs_init(int argc, char **argv, mach_port_t bootstrap_resume_task, const char *name, const char *path, mach_port_t *bootstrap);
diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
index bbd73555..029a8da7 100644
--- a/libmachdev/trivfs_server.c
+++ b/libmachdev/trivfs_server.c
@@ -289,17 +289,26 @@ trivfs_S_fsys_init (struct trivfs_control *fsys,
retry_type retry;
string_t retry_name;
mach_port_t right = MACH_PORT_NULL;
- process_t proc, parent_proc;
/* Traverse to the bootstrapping server first */
task_get_bootstrap_port (mach_task_self (), &bootstrap);
if (bootstrap)
{
+ process_t parent_proc;
err = proc_task2proc (procserver, parent_task, &parent_proc);
assert_perror_backtrace (err);
+
+ /* We don't need this anymore. */
+ mach_port_deallocate (mach_task_self (), parent_task);
+ parent_task = MACH_PORT_NULL;
+
+ proc_mark_exec(parent_proc);
+
err = fsys_init (bootstrap, parent_proc, MACH_MSG_TYPE_COPY_SEND, authhandle);
assert_perror_backtrace (err);
+
+ mach_port_deallocate (mach_task_self (), parent_proc);
}
err = fsys_getroot (control_port, MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND,
idlist, 3, idlist, 3, 0,
@@ -322,18 +331,6 @@ trivfs_S_fsys_init (struct trivfs_control *fsys,
_hurd_libc_proc_init(machdev_argv);
#endif
- /* Mark us as important. */
- proc = getproc ();
- assert_backtrace (proc);
- err = proc_mark_important (proc);
- if (err && err != EPERM)
- assert_perror_backtrace (err);
- err = proc_mark_exec (proc);
- assert_perror_backtrace (err);
- err = proc_set_exe (proc, program_invocation_short_name);
- assert_perror_backtrace (err);
- mach_port_deallocate (mach_task_self (), proc);
-
if (bootstrapping)
{
if (devnode)
@@ -493,7 +490,7 @@ machdev_trivfs_init(int argc, char **argv, mach_port_t bootstrap_resume_task,
return 0;
}
-/* The system is going down. Sync data, then call trivfs_goaway() */
+/* The system is going down, sync data. */
error_t
S_startup_dosync (mach_port_t handle)
{
@@ -505,10 +502,10 @@ S_startup_dosync (mach_port_t handle)
ports_port_deref (inpi);
- /* Sync and close device(s) */
- machdev_device_shutdown (handle);
+ /* Sync device(s) */
+ machdev_device_sync ();
- return trivfs_goaway (NULL, FSYS_GOAWAY_FORCE);
+ return 0;
}
error_t