[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 28/64: boot: implement pseudo-time device
From: |
Samuel Thibault |
Subject: |
[hurd] 28/64: boot: implement pseudo-time device |
Date: |
Wed, 10 Dec 2014 15:17:05 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 4e38225c4e3af1dede56b5df6f734faaa2b2469e
Author: Justus Winter <address@hidden>
Date: Fri Nov 7 00:27:03 2014 +0100
boot: implement pseudo-time device
* boot/boot.c (pseudo_time): New variable.
(main): Allocate port `pseudo_time'.
(ds_device_open): Give out `pseudo_time'.
(ds_device_map): Emulate Mach-style `Mapped Time'.
---
boot/boot.c | 38 +++++++++++++++++++++++++++++++++++---
1 file changed, 35 insertions(+), 3 deletions(-)
diff --git a/boot/boot.c b/boot/boot.c
index d35ce50..747ab73 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -112,7 +112,7 @@ typedef struct stat host_stat_t;
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;
+mach_port_t pseudo_console, pseudo_root, pseudo_time;
auth_t authserver;
struct store *root_store;
@@ -534,6 +534,15 @@ main (int argc, char **argv, char **envp)
if (foo != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), foo);
+ mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
+ &pseudo_time);
+ mach_port_move_member (mach_task_self (), pseudo_time, receive_set);
+ mach_port_request_notification (mach_task_self (), pseudo_time,
+ MACH_NOTIFY_NO_SENDERS, 1, pseudo_time,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE, &foo);
+ if (foo != MACH_PORT_NULL)
+ mach_port_deallocate (mach_task_self (), foo);
+
if (kernel_command_line == 0)
asprintf (&kernel_command_line, "%s %s root=%s",
argv[0], bootstrap_args, bootdevice);
@@ -894,6 +903,12 @@ ds_device_open (mach_port_t master_port,
*devicetype = MACH_MSG_TYPE_MAKE_SEND;
return 0;
}
+ else if (!strcmp (name, "time"))
+ {
+ *device = pseudo_time;
+ *devicetype = MACH_MSG_TYPE_MAKE_SEND;
+ return 0;
+ }
else if (strcmp (name, "pseudo-root") == 0)
/* Magic root device. */
{
@@ -1125,9 +1140,26 @@ ds_device_map (device_t device,
memory_object_t *pager,
int unmap)
{
- if (device != pseudo_console && device != pseudo_root)
+ if (device == pseudo_console || device == pseudo_root)
+ return D_INVALID_OPERATION;
+ else if (device == pseudo_time)
+ {
+ error_t err;
+ mach_port_t wr_memobj;
+ file_t node = file_name_lookup ("/dev/time", O_RDONLY, 0);
+
+ if (node == MACH_PORT_NULL)
+ return D_IO_ERROR;
+
+ err = io_map (node, pager, &wr_memobj);
+ if (!err && MACH_PORT_VALID (wr_memobj))
+ mach_port_deallocate (mach_task_self (), wr_memobj);
+
+ mach_port_deallocate (mach_task_self (), node);
+ return D_SUCCESS;
+ }
+ else
return D_NO_SUCH_DEVICE;
- return D_INVALID_OPERATION;
}
kern_return_t
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 40/64: libnetfs: add a payload-aware intrans function, (continued)
- [hurd] 40/64: libnetfs: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 21/64: Makeconf: handle the gnumach protocol, Samuel Thibault, 2014/12/10
- [hurd] 39/64: libdiskfs: add payload-aware intrans functions, Samuel Thibault, 2014/12/10
- [hurd] 18/64: startup: be more specific in the shutdown message, Samuel Thibault, 2014/12/10
- [hurd] 42/64: libpager: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 19/64: startup: fix the declaration of the *_server functions, Samuel Thibault, 2014/12/10
- [hurd] 43/64: libcons: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 46/64: console-client: make the demuxer payload-aware, Samuel Thibault, 2014/12/10
- [hurd] 41/64: libtrivfs: add payload-aware intrans functions, Samuel Thibault, 2014/12/10
- [hurd] 20/64: startup: bind the startup server to /servers/startup, Samuel Thibault, 2014/12/10
- [hurd] 28/64: boot: implement pseudo-time device,
Samuel Thibault <=
- [hurd] 47/64: exec: add payload-aware intrans functions, Samuel Thibault, 2014/12/10
- [hurd] 49/64: pfinet: make the demuxers payload-aware, Samuel Thibault, 2014/12/10
- [hurd] 50/64: pflocal: add payload-aware intrans functions, Samuel Thibault, 2014/12/10
- [hurd] 48/64: pfinet: add payload-aware intrans functions, Samuel Thibault, 2014/12/10
- [hurd] 51/64: proc: add payload-aware intrans functions, Samuel Thibault, 2014/12/10
- [hurd] 24/64: boot: drop bootstrap compat code, Samuel Thibault, 2014/12/10
- [hurd] 52/64: startup: disable default payload to port mapping, Samuel Thibault, 2014/12/10
- [hurd] 55/64: trans/ifsock: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 27/64: boot: support ds_device_get_status with flavor DEV_GET_RECORDS, Samuel Thibault, 2014/12/10
- [hurd] 35/64: libshouldbeinlibc: move the reference counting primitives here, Samuel Thibault, 2014/12/10