diff options
author | Miles Bader <miles@gnu.org> | 1995-04-09 05:22:54 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-04-09 05:22:54 +0000 |
commit | 05071deb5598cb822bf3a890776dca1076cc0505 (patch) | |
tree | 098596c9d4f5e8932f988345c2149f929e069c4c /trans/ifsock.c | |
parent | ad3092b8a5dd161000c753ec2743d46df7ba946d (diff) |
Use trivfs_startup() instead of doing things manually.
Get rid of _libports_initialize() [it gets called automatically].
Use error() to print error messages.
Diffstat (limited to 'trans/ifsock.c')
-rw-r--r-- | trans/ifsock.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/trans/ifsock.c b/trans/ifsock.c index ffa21db1..b6862aba 100644 --- a/trans/ifsock.c +++ b/trans/ifsock.c @@ -23,7 +23,7 @@ #include <hurd/socket.h> #include <hurd/fsys.h> #include <stdio.h> -#include <assert.h> +#include <error.h> #include <fcntl.h> #include "ifsock_S.h" @@ -51,34 +51,19 @@ int trivfs_cntl_nporttypes = 1; int main (int argc, char **argv) { - mach_port_t bootstrap; + error_t err; mach_port_t pflocal; - mach_port_t ourcntl; - mach_port_t realnode; + mach_port_t bootstrap; char buf[512]; - struct trivfs_control *cntl; - error_t error; - - _libports_initialize (); task_get_bootstrap_port (mach_task_self (), &bootstrap); if (bootstrap == MACH_PORT_NULL) - { - fprintf (stderr, "%s must be started as a translator\n", argv[0]); - exit (1); - } + error(1, 0, "Must be started as a translator"); /* Reply to our parent */ - ourcntl = trivfs_handle_port (MACH_PORT_NULL, PT_CTL, PT_NODE); - error = fsys_startup (bootstrap, ourcntl, MACH_MSG_TYPE_MAKE_SEND, - &realnode); - - /* Install the returned realnode for trivfs's use */ - cntl = ports_check_port_type (ourcntl, PT_CTL); - assert (cntl); - ports_change_hardsoft (cntl, 1); - cntl->underlying = realnode; - ports_done_with_port (cntl); + err = trivfs_startup (bootstrap, PT_CTL, PT_NODE, NULL); + if (err) + error(2, err, "Contacting parent"); /* Try and connect to the pflocal server */ sprintf (buf, "%s/%d", _SERVERS_SOCKET, PF_LOCAL); |