summaryrefslogtreecommitdiff
path: root/libfshelp/start-translator-long.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-11-02 22:58:58 +0000
committerMiles Bader <miles@gnu.org>1995-11-02 22:58:58 +0000
commit20f9acdd40770065b994f3f58a7fcda32064a6cc (patch)
treeb0c6991b04888d467104f488ed84dd9d97268e94 /libfshelp/start-translator-long.c
parent13b5228b252286e3539966abadf7fe3ba71da6a8 (diff)
(fshelp_start_translator_long, service_fsys_startup):
Change to use a callback function instead of passing the actual node. (service_fsys_startup): Support the open flags coming from the translator. (struct fsys_startup_request): Add the flags field. (flagsCheck): New variable.
Diffstat (limited to 'libfshelp/start-translator-long.c')
-rw-r--r--libfshelp/start-translator-long.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/libfshelp/start-translator-long.c b/libfshelp/start-translator-long.c
index 05187dac..d8890542 100644
--- a/libfshelp/start-translator-long.c
+++ b/libfshelp/start-translator-long.c
@@ -33,6 +33,8 @@
struct fsys_startup_request
{
mach_msg_header_t head;
+ mach_msg_type_t flagsType;
+ int flags;
mach_msg_type_t control_portType;
mach_port_t control_port;
};
@@ -46,6 +48,16 @@ struct fsys_startup_reply
mach_port_t realnode;
};
+static const mach_msg_type_t flagsCheck = {
+ MACH_MSG_TYPE_INTEGER_32, /* msgt_name = */
+ 32, /* msgt_size = */
+ 1, /* msgt_number = */
+ TRUE, /* msgt_inline = */
+ FALSE, /* msgt_longform = */
+ FALSE, /* msgt_deallocate = */
+ 0 /* msgt_unused = */
+};
+
static const mach_msg_type_t control_portCheck =
{
17, /* msgt_name = */
@@ -86,9 +98,9 @@ static const mach_msg_type_t realnodeType =
translator died, and EDIED will be returned. If an error occurs, the
error code is returned, otherwise 0. */
static error_t
-service_fsys_startup(file_t node, mach_msg_type_name_t node_type,
- mach_port_t port, long timeout,
- fsys_t *control)
+service_fsys_startup (fshelp_open_fn_t underlying_open_fn,
+ mach_port_t port, long timeout,
+ fsys_t *control)
{
error_t err;
union
@@ -123,19 +135,20 @@ service_fsys_startup(file_t node, mach_msg_type_name_t node_type,
if (request.head.msgh_id != 22000)
reply.RetCode = MIG_BAD_ID;
- else if (*(int *)&request.startup.control_portType
- != *(int *)&control_portCheck)
+ else if ((*(int *)&request.startup.control_portType
+ != *(int *)&control_portCheck)
+ || (*(int *)&request.startup.flagsType != *(int *)&flagsCheck))
reply.RetCode = MIG_BAD_ARGUMENTS;
else
{
*control = request.startup.control_port;
- reply.RetCode = KERN_SUCCESS;
reply.realnodeType = realnodeType;
+ reply.RetCode =
+ (*underlying_open_fn) (request.startup.flags,
+ &reply.realnode, &reply.realnodeType.msgt_name);
- reply.realnode = node;
- reply.realnodeType.msgt_name = node_type;
- if (node != MACH_PORT_NULL)
+ if (!reply.RetCode && reply.realnode != MACH_PORT_NULL)
/* The message can't be simple because of the port. */
reply.head.msgh_bits |= MACH_MSGH_BITS_COMPLEX;
}
@@ -153,8 +166,7 @@ service_fsys_startup(file_t node, mach_msg_type_name_t node_type,
error_t
-fshelp_start_translator_long (file_t underlying,
- mach_msg_type_name_t underlying_type,
+fshelp_start_translator_long (fshelp_open_fn_t underlying_open_fn,
char *name, char *argz, int argz_len,
mach_port_t *fds,
mach_msg_type_name_t fds_type, int fds_len,
@@ -244,8 +256,7 @@ fshelp_start_translator_long (file_t underlying,
/* Ok, cool, we've got a running(?) program, now rendezvous with it if
possible using the startup protocol on the bootstrap port... */
- err = service_fsys_startup(underlying, underlying_type, bootstrap,
- timeout, control);
+ err = service_fsys_startup(underlying_open_fn, bootstrap, timeout, control);
lose:
if (!ports_moved)