diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-11-06 13:59:59 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-11-21 05:55:41 +0100 |
commit | a99d8b562d74e3b08c88d52433914d9c1c6bd362 (patch) | |
tree | cbc77993e3776cccfdd394bb97db9c47ab368732 /boot | |
parent | 5133c8eb5d6564d037c9c7312ee4506c0d2e49a7 (diff) |
boot: remove unused function `boot_script_read_file'
The unused function `boot_script_read_file' requires access to the
default pager, which is privileged.
* boot/boot.c (defpager): Remove now unused variable.
(boot_script_read_file): Remove unused function.
(main): Do not acquire port to the default pager.
* boot/boot_script.h (boot_script_read_file): Remove declaration.
Diffstat (limited to 'boot')
-rw-r--r-- | boot/boot.c | 46 | ||||
-rw-r--r-- | boot/boot_script.h | 4 |
2 files changed, 1 insertions, 49 deletions
diff --git a/boot/boot.c b/boot/boot.c index d5b80968..250018ee 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -109,7 +109,7 @@ typedef struct stat host_stat_t; #endif /* UX */ -mach_port_t privileged_host_port, master_device_port, defpager; +mach_port_t privileged_host_port, master_device_port; mach_port_t pseudo_master_device_port; mach_port_t receive_set; mach_port_t pseudo_console, pseudo_root; @@ -281,47 +281,6 @@ void read_reply (); void * msg_thread (void *); /* Callbacks for boot_script.c; see boot_script.h. */ - -mach_port_t -boot_script_read_file (const char *filename) -{ - static const char msg[] = ": cannot open\n"; - int fd = useropen (filename, O_RDONLY, 0); - host_stat_t st; - error_t err; - mach_port_t memobj; - vm_address_t region; - - write (2, filename, strlen (filename)); - if (fd < 0) - { - write (2, msg, sizeof msg - 1); - host_exit (1); - } - else - write (2, msg + sizeof msg - 2, 1); - - host_fstat (fd, &st); - - err = default_pager_object_create (defpager, &memobj, - round_page (st.st_size)); - if (err) - { - static const char msg[] = "cannot create default-pager object\n"; - write (2, msg, sizeof msg - 1); - host_exit (1); - } - - region = 0; - vm_map (mach_task_self (), ®ion, round_page (st.st_size), - 0, 1, memobj, 0, 0, VM_PROT_ALL, VM_PROT_ALL, VM_INHERIT_NONE); - read (fd, (char *) region, st.st_size); - munmap ((caddr_t) region, round_page (st.st_size)); - - close (fd); - return memobj; -} - int boot_script_exec_cmd (void *hook, mach_port_t task, char *path, int argc, @@ -532,9 +491,6 @@ main (int argc, char **argv, char **envp) get_privileged_ports (&privileged_host_port, &master_device_port); - defpager = MACH_PORT_NULL; - vm_set_default_memory_manager (privileged_host_port, &defpager); - strcat (bootstrap_args, "f"); mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_PORT_SET, diff --git a/boot/boot_script.h b/boot/boot_script.h index 62458693..da52e6f0 100644 --- a/boot/boot_script.h +++ b/boot/boot_script.h @@ -69,10 +69,6 @@ int boot_script_exec_cmd (void *hook, task_t task, char *path, int argc, char **argv, char *strings, int stringlen); -/* The user must define this function. Load the contents of FILE - into a fresh anonymous memory object and return the memory object port. */ -mach_port_t boot_script_read_file (const char *file); - /* The user must define this functions to perform the corresponding Mach task manipulations. */ int boot_script_task_create (struct cmd *); /* task_create + task_suspend */ |