summaryrefslogtreecommitdiff
path: root/trans/symlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'trans/symlink.c')
-rw-r--r--trans/symlink.c85
1 files changed, 77 insertions, 8 deletions
diff --git a/trans/symlink.c b/trans/symlink.c
index 791befe7..52ca7de2 100644
--- a/trans/symlink.c
+++ b/trans/symlink.c
@@ -15,6 +15,12 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include <hurd.h>
+#include <stdio.h>
+#include <hurd/fsys.h>
+#include <fcntl.h>
+#include "fsys_S.h"
+
mach_port_t realnode;
/* We return this for O_NOLINK lookups */
@@ -23,12 +29,14 @@ mach_port_t realnodenoauth;
/* We return this for non O_NOLINK lookups */
char *linktarget;
+extern int fsys_server (mach_msg_header_t *, mach_msg_header_t *);
+
+int
main (int argc, char **argv)
{
mach_port_t bootstrap;
mach_port_t control;
-
- _libports_initialize ();
+ error_t error;
task_get_bootstrap_port (mach_task_self (), &bootstrap);
if (bootstrap == MACH_PORT_NULL)
@@ -46,17 +54,29 @@ main (int argc, char **argv)
linktarget = argv[1];
/* Reply to our parent */
- control = ports_allocate_port (PT_CTL, sizeof (struct port_info));
- error = fsys_startup (bootstrap, ports_get_right (control),
+ mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &control);
+ error = fsys_startup (bootstrap, control,
MACH_MSG_TYPE_MAKE_SEND, &realnode);
-
+ if (error)
+ {
+ perror ("Starting up translator");
+ exit (1);
+ }
io_restrict_auth (realnode, &realnodenoauth, 0, 0, 0, 0);
+ mach_port_deallocate (mach_task_self (), realnode);
/* Launch */
- ports_manage_port_operations_onethread ();
- return 0;
+ while (1)
+ {
+ /* The timeout here is 10 minutes */
+ error = mach_msg_server_timeout (fsys_server, 0, control,
+ MACH_RCV_TIMEOUT, 1000 * 60 * 10);
+ if (error == MACH_RCV_TIMED_OUT)
+ exit (0);
+ }
}
+error_t
S_fsys_getroot (mach_port_t fsys_t,
mach_port_t dotdotnode,
uid_t *uids,
@@ -67,7 +87,7 @@ S_fsys_getroot (mach_port_t fsys_t,
retry_type *do_retry,
char *retry_name,
mach_port_t *ret,
- mach_port_name_t *rettype)
+ mach_msg_type_name_t *rettype)
{
if (flags & O_NOLINK)
{
@@ -97,3 +117,52 @@ S_fsys_getroot (mach_port_t fsys_t,
}
return 0;
}
+
+error_t
+S_fsys_startup (mach_port_t bootstrap,
+ mach_port_t control,
+ mach_port_t *real,
+ mach_msg_type_name_t *realtype)
+{
+ return EOPNOTSUPP;
+}
+
+error_t
+S_fsys_goaway (mach_port_t control,
+ int flags)
+{
+ exit (0);
+}
+
+error_t
+S_fsys_getfile (mach_port_t control,
+ uid_t *uids,
+ u_int nuids,
+ uid_t *gids,
+ u_int ngids,
+ char *handle,
+ u_int handllen,
+ mach_port_t *pt,
+ mach_msg_type_name_t *pttype)
+{
+ return EOPNOTSUPP;
+}
+
+error_t
+S_fsys_getpriv (mach_port_t control,
+ mach_port_t *hostpriv,
+ mach_port_t *devmaster,
+ task_t *fstask)
+{
+ return EOPNOTSUPP;
+}
+
+error_t
+S_fsys_init (mach_port_t control,
+ mach_port_t reply,
+ mach_msg_type_name_t replytype,
+ mach_port_t proc,
+ auth_t auth)
+{
+ return EOPNOTSUPP;
+}