/[hurd]/hurd/trans/symlink.c
ViewVC logotype

Diff of /hurd/trans/symlink.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by roland, Mon Feb 26 04:16:01 2001 UTC revision 1.12 by neal, Tue Mar 26 19:11:46 2002 UTC
# Line 1  Line 1 
1  /* Translator for S_IFLNK nodes  /* Translator for S_IFLNK nodes
2     Copyright (C) 1994, 2000, 2001 Free Software Foundation     Copyright (C) 1994, 2000, 2001, 2002 Free Software Foundation
3    
4     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
5     modify it under the terms of the GNU General Public License as     modify it under the terms of the GNU General Public License as
# Line 21  Line 21 
21  #include <string.h>  #include <string.h>
22  #include <hurd/fsys.h>  #include <hurd/fsys.h>
23  #include <fcntl.h>  #include <fcntl.h>
24    #include <errno.h>
25    #include <error.h>
26  #include "fsys_S.h"  #include "fsys_S.h"
27    
28  mach_port_t realnode;  mach_port_t realnode;
# Line 38  main (int argc, char **argv) Line 40  main (int argc, char **argv)
40  {  {
41    mach_port_t bootstrap;    mach_port_t bootstrap;
42    mach_port_t control;    mach_port_t control;
43    error_t error;    error_t err;
   
   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);  
     }  
44    
45    if (argc != 2)    if (argc != 2)
46      {      {
# Line 53  main (int argc, char **argv) Line 48  main (int argc, char **argv)
48        exit (1);        exit (1);
49      }      }
50    
51      task_get_bootstrap_port (mach_task_self (), &bootstrap);
52      if (bootstrap == MACH_PORT_NULL)
53        error (1, 0, "Must be started as a translator");
54    
55    linktarget = argv[1];    linktarget = argv[1];
56    
57    /* Reply to our parent */    /* Reply to our parent */
58    mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &control);    mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &control);
59    mach_port_insert_right (mach_task_self (), control, control,    mach_port_insert_right (mach_task_self (), control, control,
60                            MACH_MSG_TYPE_MAKE_SEND);                            MACH_MSG_TYPE_MAKE_SEND);
61    error =    err =
62      fsys_startup (bootstrap, 0, control, MACH_MSG_TYPE_COPY_SEND, &realnode);      fsys_startup (bootstrap, 0, control, MACH_MSG_TYPE_COPY_SEND, &realnode);
63    mach_port_deallocate (mach_task_self (), control);    mach_port_deallocate (mach_task_self (), control);
64    mach_port_deallocate (mach_task_self (), bootstrap);    mach_port_deallocate (mach_task_self (), bootstrap);
65    if (error)    if (err)
66      {      error (1, err, "Starting up translator");
67        perror ("Starting up translator");  
       exit (1);  
     }  
68    io_restrict_auth (realnode, &realnodenoauth, 0, 0, 0, 0);    io_restrict_auth (realnode, &realnodenoauth, 0, 0, 0, 0);
69    mach_port_deallocate (mach_task_self (), realnode);    mach_port_deallocate (mach_task_self (), realnode);
70    
# Line 75  main (int argc, char **argv) Line 72  main (int argc, char **argv)
72    while (1)    while (1)
73      {      {
74        /* The timeout here is 10 minutes */        /* The timeout here is 10 minutes */
75        error = mach_msg_server_timeout (fsys_server, 0, control,        err = mach_msg_server_timeout (fsys_server, 0, control,
76                                         MACH_RCV_TIMEOUT, 1000 * 60 * 10);                                       MACH_RCV_TIMEOUT, 1000 * 60 * 10);
77        if (error == MACH_RCV_TIMED_OUT)        if (err == MACH_RCV_TIMED_OUT)
78          exit (0);          exit (0);
79      }      }
80  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26