VirtualBox

忽略:
時間撮記:
2018-3-12 下午07:32:29 (7 年 以前)
作者:
bird
訊息:

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • vendor/gnumake/current/remote-cstms.c

    r2596 r3138  
    44   the Make maintainers.
    55
    6 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    7 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
    8 2010 Free Software Foundation, Inc.
     6Copyright (C) 1988-2016 Free Software Foundation, Inc.
    97This file is part of GNU Make.
    108
     
    2119this program.  If not, see <http://www.gnu.org/licenses/>.  */
    2220
    23 #include "make.h"
    24 #include "job.h"
     21#include "makeint.h"
    2522#include "filedef.h"
    2623#include "commands.h"
     
    3532char *remote_description = "Customs";
    3633
    37 /* File name of the Customs `export' client command.
     34/* File name of the Customs 'export' client command.
    3835   A full path name can be used to avoid some path-searching overhead.  */
    39 #define EXPORT_COMMAND  "/usr/local/bin/export"
     36#define EXPORT_COMMAND  "/usr/local/bin/export"
    4037
    4138/* ExportPermit gotten by start_remote_job_p, and used by start_remote_job.  */
     
    8077
    8178      /* For secure Customs, make is installed setuid root and
    82         Customs requires a privileged source port be used.  */
     79        Customs requires a privileged source port be used.  */
    8380      make_access ();
    8481
    8582      if (ISDB (DB_JOBS))
    86         Rpc_Debug(1);
     83        Rpc_Debug (1);
    8784
    8885      /* Ping the daemon once to see if it is there.  */
     
    9390
    9491      if (starting_directory == 0)
    95         /* main couldn't figure it out.  */
    96         inited = -1;
     92        /* main couldn't figure it out.  */
     93        inited = -1;
    9794      else
    98         {
    99           /* Normalize the current directory path name to something
    100              that should work on all machines exported to.  */
    101 
    102           normalized_cwd = xmalloc (GET_PATH_MAX);
    103           strcpy (normalized_cwd, starting_directory);
    104           if (Customs_NormPath (normalized_cwd, GET_PATH_MAX) < 0)
    105             /* Path normalization failure means using Customs
    106                won't work, but it's not really an error.  */
    107             inited = -1;
    108         }
     95        {
     96          /* Normalize the current directory path name to something
     97             that should work on all machines exported to.  */
     98
     99          normalized_cwd = xmalloc (GET_PATH_MAX);
     100          strcpy (normalized_cwd, starting_directory);
     101          if (Customs_NormPath (normalized_cwd, GET_PATH_MAX) < 0)
     102            /* Path normalization failure means using Customs
     103               won't work, but it's not really an error.  */
     104            inited = -1;
     105        }
    109106    }
    110107
     
    114111  njobs = job_slots_used;
    115112  if (!first_p)
    116     njobs -= 1;         /* correction for being called from reap_children() */
     113    njobs -= 1;         /* correction for being called from reap_children() */
    117114
    118115  /* the first job should run locally, or, if the -l flag is given, we use
     
    157154  if (retsock < 0)
    158155    {
    159       error (NILF, "exporting: Couldn't create return socket.");
     156      O (error, NILF, "exporting: Couldn't create return socket.");
    160157      return 1;
    161158    }
     
    176173  /* Create a WayBill to give to the server.  */
    177174  len = Customs_MakeWayBill (&permit, normalized_cwd, argv[0], argv,
    178                              envp, retport, waybill);
    179 
    180   /* Modify the waybill as if the remote child had done `child_access ()'.  */
     175                             envp, retport, waybill);
     176
     177  /* Modify the waybill as if the remote child had done 'child_access ()'.  */
    181178  {
    182179    WayBill *wb = (WayBill *) waybill;
     
    192189  sin.sin_addr = permit.addr;
    193190  status = Rpc_Call (sock, &sin, (Rpc_Proc) CUSTOMS_IMPORT,
    194                      len, (Rpc_Opaque) waybill,
    195                      sizeof(msg), (Rpc_Opaque) msg,
    196                      1, &timeout);
    197 
    198   host = gethostbyaddr((char *)&permit.addr, sizeof(permit.addr), AF_INET);
    199 
    200   if (status != RPC_SUCCESS)
    201     {
    202       (void) close (retsock);
    203       (void) close (sock);
    204       error (NILF, "exporting to %s: %s",
    205              host ? host->h_name : inet_ntoa (permit.addr),
    206              Rpc_ErrorMessage (status));
    207       return 1;
    208     }
    209   else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0')
    210     {
    211       (void) close (retsock);
    212       (void) close (sock);
    213       error (NILF, "exporting to %s: %s",
    214              host ? host->h_name : inet_ntoa (permit.addr),
    215              msg);
    216       return 1;
    217     }
    218   else
    219     {
    220       error (NILF, "*** exported to %s (id %u)",
    221               host ? host->h_name : inet_ntoa (permit.addr),
    222               permit.id);
    223     }
    224 
    225   fflush (stdout);
    226   fflush (stderr);
     191                     len, (Rpc_Opaque) waybill,
     192                     sizeof (msg), (Rpc_Opaque) msg,
     193                     1, &timeout);
     194
     195  host = gethostbyaddr ((char *)&permit.addr, sizeof(permit.addr), AF_INET);
     196
     197  {
     198    const char *hnm = host ? host->h_name : inet_ntoa (permit.addr);
     199    size_t hlen = strlen (hnm);
     200
     201    if (status != RPC_SUCCESS)
     202      {
     203        const char *err = Rpc_ErrorMessage (status);
     204        (void) close (retsock);
     205        (void) close (sock);
     206        error (NILF, hlen + strlen (err),
     207               "exporting to %s: %s", hnm, err);
     208        return 1;
     209      }
     210    else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0')
     211      {
     212        (void) close (retsock);
     213        (void) close (sock);
     214        error (NILF, hlen + strlen (msg), "exporting to %s: %s", hnm, msg);
     215        return 1;
     216      }
     217    else
     218      {
     219        error (NILF, hlen + INTSTR_LENGTH,
     220               "*** exported to %s (id %u)", hnm, permit.id);
     221      }
     222
     223    fflush (stdout);
     224    fflush (stderr);
     225  }
    227226
    228227  pid = vfork ();
     
    230229    {
    231230      /* The fork failed!  */
    232       perror_with_name ("vfork", "");
     231      perror_with_name ("fork", "");
    233232      return 1;
    234233    }
    235234  else if (pid == 0)
    236235    {
    237       /* Child side.  Run `export' to handle the connection.  */
     236      /* Child side.  Run 'export' to handle the connection.  */
    238237      static char sock_buf[20], retsock_buf[20], id_buf[20];
    239238      static char *new_argv[6] =
    240         { EXPORT_COMMAND, "-id", sock_buf, retsock_buf, id_buf, 0 };
     239        { EXPORT_COMMAND, "-id", sock_buf, retsock_buf, id_buf, 0 };
    241240
    242241      /* Set up the arguments.  */
     
    247246      /* Get the right stdin.  */
    248247      if (stdin_fd != 0)
    249         (void) dup2 (stdin_fd, 0);
     248        (void) dup2 (stdin_fd, 0);
    250249
    251250      /* Unblock signals in the child.  */
     
    256255    }
    257256
    258   /* Parent side.  Return the `export' process's ID.  */
     257  /* Parent side.  Return the 'export' process's ID.  */
    259258  (void) close (retsock);
    260259  (void) close (sock);
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette